evolution-3.6.4/modules/itip-formatter/e-source-conflict-search.c

No issues found

  1 /*
  2  * e-source-conflict-search.c
  3  *
  4  * This program is free software; you can redistribute it and/or
  5  * modify it under the terms of the GNU Lesser General Public
  6  * License as published by the Free Software Foundation; either
  7  * version 2 of the License, or (at your option) version 3.
  8  *
  9  * This program is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12  * Lesser General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU Lesser General Public
 15  * License along with the program; if not, see <http://www.gnu.org/licenses/>
 16  *
 17  */
 18 
 19 #include "e-source-conflict-search.h"
 20 
 21 #define E_SOURCE_CONFLICT_SEARCH_GET_PRIVATE(obj) \
 22 	(G_TYPE_INSTANCE_GET_PRIVATE \
 23 	((obj), E_TYPE_SOURCE_CONFLICT_SEARCH, ESourceConflictSearchPrivate))
 24 
 25 struct _ESourceConflictSearchPrivate {
 26 	gboolean include_me;
 27 };
 28 
 29 enum {
 30 	PROP_0,
 31 	PROP_INCLUDE_ME
 32 };
 33 
 34 G_DEFINE_TYPE (
 35 	ESourceConflictSearch,
 36 	e_source_conflict_search,
 37 	E_TYPE_SOURCE_EXTENSION)
 38 
 39 static void
 40 source_conflict_search_set_property (GObject *object,
 41                                      guint property_id,
 42                                      const GValue *value,
 43                                      GParamSpec *pspec)
 44 {
 45 	switch (property_id) {
 46 		case PROP_INCLUDE_ME:
 47 			e_source_conflict_search_set_include_me (
 48 				E_SOURCE_CONFLICT_SEARCH (object),
 49 				g_value_get_boolean (value));
 50 			return;
 51 	}
 52 
 53 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 54 }
 55 
 56 static void
 57 source_conflict_search_get_property (GObject *object,
 58                                      guint property_id,
 59                                      GValue *value,
 60                                      GParamSpec *pspec)
 61 {
 62 	switch (property_id) {
 63 		case PROP_INCLUDE_ME:
 64 			g_value_set_boolean (
 65 				value,
 66 				e_source_conflict_search_get_include_me (
 67 				E_SOURCE_CONFLICT_SEARCH (object)));
 68 			return;
 69 	}
 70 
 71 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 72 }
 73 
 74 static void
 75 e_source_conflict_search_class_init (ESourceConflictSearchClass *class)
 76 {
 77 	GObjectClass *object_class;
 78 	ESourceExtensionClass *extension_class;
 79 
 80 	g_type_class_add_private (class, sizeof (ESourceConflictSearchPrivate));
 81 
 82 	object_class = G_OBJECT_CLASS (class);
 83 	object_class->set_property = source_conflict_search_set_property;
 84 	object_class->get_property = source_conflict_search_get_property;
 85 
 86 	extension_class = E_SOURCE_EXTENSION_CLASS (class);
 87 	extension_class->name = E_SOURCE_EXTENSION_CONFLICT_SEARCH;
 88 
 89 	g_object_class_install_property (
 90 		object_class,
 91 		PROP_INCLUDE_ME,
 92 		g_param_spec_boolean (
 93 			"include-me",
 94 			"IncludeMe",
 95 			"Include this calendar in when "
 96 			"searching for scheduling conflicts",
 97 			TRUE,
 98 			G_PARAM_READWRITE |
 99 			G_PARAM_CONSTRUCT |
100 			G_PARAM_STATIC_STRINGS |
101 			E_SOURCE_PARAM_SETTING));
102 }
103 
104 static void
105 e_source_conflict_search_init (ESourceConflictSearch *extension)
106 {
107 	extension->priv = E_SOURCE_CONFLICT_SEARCH_GET_PRIVATE (extension);
108 }
109 
110 /**
111  * e_source_conflict_search_get_include_me:
112  * @extension: an #ESourceConflictSearch
113  *
114  * Returns whether the calendar described by the #ESource to which
115  * @extension belongs should be queried for scheduling conflicts when
116  * negotiating a meeting invitation.
117  *
118  * Returns: whether to search for scheduling conflicts
119  *
120  * Since: 3.6
121  **/
122 gboolean
123 e_source_conflict_search_get_include_me (ESourceConflictSearch *extension)
124 {
125 	g_return_val_if_fail (E_IS_SOURCE_CONFLICT_SEARCH (extension), FALSE);
126 
127 	return extension->priv->include_me;
128 }
129 
130 /**
131  * e_source_conflict_search_set_include_me:
132  * @extension: an #ESourceConflictSearch
133  * @include_me: whether to search for scheduling conflicts
134  *
135  * Sets whether the calendar described by the #ESource to which @extension
136  * belongs should be queried for scheduling conflicts when negotiating a
137  * meeting invitation.
138  *
139  * Since: 3.6
140  **/
141 void
142 e_source_conflict_search_set_include_me (ESourceConflictSearch *extension,
143                                          gboolean include_me)
144 {
145 	g_return_if_fail (E_IS_SOURCE_CONFLICT_SEARCH (extension));
146 
147 	if (extension->priv->include_me == include_me)
148 		return;
149 
150 	extension->priv->include_me = include_me;
151 
152 	g_object_notify (G_OBJECT (extension), "include-me");
153 }