evolution-3.6.4/modules/addressbook/e-book-config-name-selector-entry.c

No issues found

  1 /*
  2  * e-book-config-name-selector-entry.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 #ifdef HAVE_CONFIG_H
 20 #include <config.h>
 21 #endif
 22 
 23 #include "e-book-config-name-selector-entry.h"
 24 
 25 #include <libedataserverui/libedataserverui.h>
 26 
 27 #define E_BOOK_CONFIG_NAME_SELECTOR_ENTRY_GET_PRIVATE(obj) \
 28 	(G_TYPE_INSTANCE_GET_PRIVATE \
 29 	((obj), E_TYPE_BOOK_CONFIG_NAME_SELECTOR_ENTRY, EBookConfigNameSelectorEntryPrivate))
 30 
 31 struct _EBookConfigNameSelectorEntryPrivate {
 32 	GSettings *settings;
 33 };
 34 
 35 G_DEFINE_DYNAMIC_TYPE (
 36 	EBookConfigNameSelectorEntry,
 37 	e_book_config_name_selector_entry,
 38 	E_TYPE_EXTENSION)
 39 
 40 static void
 41 book_config_name_selector_entry_dispose (GObject *object)
 42 {
 43 	EBookConfigNameSelectorEntryPrivate *priv;
 44 
 45 	priv = E_BOOK_CONFIG_NAME_SELECTOR_ENTRY_GET_PRIVATE (object);
 46 
 47 	if (priv->settings != NULL) {
 48 		g_object_unref (priv->settings);
 49 		priv->settings = NULL;
 50 	}
 51 
 52 	/* Chain up to parent's dispose() method. */
 53 	G_OBJECT_CLASS (e_book_config_name_selector_entry_parent_class)->
 54 		dispose (object);
 55 }
 56 
 57 static void
 58 book_config_name_selector_entry_constructed (GObject *object)
 59 {
 60 	EBookConfigNameSelectorEntry *extension;
 61 	EExtensible *extensible;
 62 
 63 	extension = E_BOOK_CONFIG_NAME_SELECTOR_ENTRY (object);
 64 	extensible = e_extension_get_extensible (E_EXTENSION (extension));
 65 
 66 	/* Chain up to parent's consturcted() method. */
 67 	G_OBJECT_CLASS (e_book_config_name_selector_entry_parent_class)->
 68 		constructed (object);
 69 
 70 	g_settings_bind (
 71 		extension->priv->settings, "completion-minimum-query-length",
 72 		extensible, "minimum-query-length",
 73 		G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
 74 
 75 	g_settings_bind (
 76 		extension->priv->settings, "completion-show-address",
 77 		extensible, "show-address",
 78 		G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
 79 }
 80 
 81 static void
 82 e_book_config_name_selector_entry_class_init (EBookConfigNameSelectorEntryClass *class)
 83 {
 84 	GObjectClass *object_class;
 85 	EExtensionClass *extension_class;
 86 
 87 	g_type_class_add_private (
 88 		class, sizeof (EBookConfigNameSelectorEntryPrivate));
 89 
 90 	object_class = G_OBJECT_CLASS (class);
 91 	object_class->dispose = book_config_name_selector_entry_dispose;
 92 	object_class->constructed = book_config_name_selector_entry_constructed;
 93 
 94 	extension_class = E_EXTENSION_CLASS (class);
 95 	extension_class->extensible_type = E_TYPE_NAME_SELECTOR_ENTRY;
 96 }
 97 
 98 static void
 99 e_book_config_name_selector_entry_class_finalize (EBookConfigNameSelectorEntryClass *class)
100 {
101 }
102 
103 static void
104 e_book_config_name_selector_entry_init (EBookConfigNameSelectorEntry *extension)
105 {
106 	extension->priv =
107 		E_BOOK_CONFIG_NAME_SELECTOR_ENTRY_GET_PRIVATE (extension);
108 	extension->priv->settings =
109 		g_settings_new ("org.gnome.evolution.addressbook");
110 }
111 
112 void
113 e_book_config_name_selector_entry_type_register (GTypeModule *type_module)
114 {
115 	/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
116 	 *     function, so we have to wrap it with a public function in
117 	 *     order to register types from a separate compilation unit. */
118 	e_book_config_name_selector_entry_register_type (type_module);
119 }