diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-11-02 02:44:23 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-11-02 02:46:03 +0800 |
commit | 7d20b8fd5fd28a90852c737f35cef7ba03a2c116 (patch) | |
tree | 0803b787043a9bb825c59ffbbda2da8b328f48a6 /addressbook/gui | |
parent | 966c22cc9440851d166a530c7e187e0f80633c57 (diff) | |
download | gsoc2013-evolution-7d20b8fd5fd28a90852c737f35cef7ba03a2c116.tar.gz gsoc2013-evolution-7d20b8fd5fd28a90852c737f35cef7ba03a2c116.tar.zst gsoc2013-evolution-7d20b8fd5fd28a90852c737f35cef7ba03a2c116.zip |
Utilize the new ESourceSelector:primary-selection property.
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-selector.c | 74 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-gui-util.c | 4 |
2 files changed, 16 insertions, 62 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-selector.c b/addressbook/gui/widgets/e-addressbook-selector.c index d746964364..2402b00e84 100644 --- a/addressbook/gui/widgets/e-addressbook-selector.c +++ b/addressbook/gui/widgets/e-addressbook-selector.c @@ -29,9 +29,6 @@ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_ADDRESSBOOK_SELECTOR, EAddressbookSelectorPrivate)) -#define PRIMARY_ADDRESSBOOK_KEY \ - "/apps/evolution/addressbook/display/primary_addressbook" - typedef struct _MergeContext MergeContext; struct _EAddressbookSelectorPrivate { @@ -149,45 +146,26 @@ addressbook_selector_merge_next_cb (EBook *book, static void addressbook_selector_load_primary_source (ESourceSelector *selector) { - GConfClient *client; ESourceList *source_list; ESource *source = NULL; - const gchar *key; - gchar *uid; - - /* XXX If ESourceSelector had a "primary-uid" property, - * we could just bind the GConf key to it. */ + GSList *groups; source_list = e_source_selector_get_source_list (selector); - client = gconf_client_get_default (); - key = PRIMARY_ADDRESSBOOK_KEY; - uid = gconf_client_get_string (client, key, NULL); - g_object_unref (client); - - if (uid != NULL) { - source = e_source_list_peek_source_by_uid (source_list, uid); - g_free (uid); - } - - if (source == NULL) { - GSList *groups; - - /* Dig up the first source in the source list. - * XXX libedataserver should provide API for this. */ - groups = e_source_list_peek_groups (source_list); - while (groups != NULL) { - ESourceGroup *source_group = groups->data; - GSList *sources; - - sources = e_source_group_peek_sources (source_group); - if (sources != NULL) { - source = sources->data; - break; - } - - groups = g_slist_next (groups); + /* Dig up the first source in the source list. + * XXX libedataserver should provide API for this. */ + groups = e_source_list_peek_groups (source_list); + while (groups != NULL) { + ESourceGroup *source_group = groups->data; + GSList *sources; + + sources = e_source_group_peek_sources (source_group); + if (sources != NULL) { + source = sources->data; + break; } + + groups = g_slist_next (groups); } if (source != NULL) @@ -254,28 +232,6 @@ addressbook_selector_constructed (GObject *object) addressbook_selector_load_primary_source (selector); } -static void -addressbook_selector_primary_selection_changed (ESourceSelector *selector) -{ - ESource *source; - GConfClient *client; - const gchar *key; - const gchar *string; - - /* XXX If ESourceSelector had a "primary-uid" property, - * we could just bind the GConf key to it. */ - - source = e_source_selector_peek_primary_selection (selector); - if (source == NULL) - return; - - client = gconf_client_get_default (); - key = PRIMARY_ADDRESSBOOK_KEY; - string = e_source_peek_uid (source); - gconf_client_set_string (client, key, string, NULL); - g_object_unref (client); -} - static gboolean addressbook_selector_data_dropped (ESourceSelector *selector, GtkSelectionData *selection_data, @@ -341,8 +297,6 @@ addressbook_selector_class_init (EAddressbookSelectorClass *class) object_class->constructed = addressbook_selector_constructed; selector_class = E_SOURCE_SELECTOR_CLASS (class); - selector_class->primary_selection_changed = - addressbook_selector_primary_selection_changed; selector_class->data_dropped = addressbook_selector_data_dropped; g_object_class_install_property ( diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index ebf4558f50..51e00fd17d 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -218,7 +218,7 @@ source_selection_changed_cb (ESourceSelector *selector, GtkWidget *ok_button) ESource *except_source = NULL, *selected; except_source = g_object_get_data (G_OBJECT (ok_button), "except-source"); - selected = e_source_selector_peek_primary_selection (selector); + selected = e_source_selector_get_primary_selection (selector); gtk_widget_set_sensitive (ok_button, selected && selected != except_source); } @@ -274,7 +274,7 @@ eab_select_source (ESource *except_source, const gchar *title, const gchar *mess response = gtk_dialog_run (GTK_DIALOG (dialog)); if (response == GTK_RESPONSE_ACCEPT) - source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (selector)); + source = e_source_selector_get_primary_selection (E_SOURCE_SELECTOR (selector)); else source = NULL; |