aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-11-02 02:44:23 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2010-11-10 06:33:21 +0800
commit26afa6081c3d9826dbae78236dd712fad8b7c340 (patch)
tree531e8587a88bc408b91341a98e20fbd934cbb344 /addressbook
parentf5460f323b2581af28764b96635b2d3a0f1548c9 (diff)
downloadgsoc2013-evolution-26afa6081c3d9826dbae78236dd712fad8b7c340.tar
gsoc2013-evolution-26afa6081c3d9826dbae78236dd712fad8b7c340.tar.gz
gsoc2013-evolution-26afa6081c3d9826dbae78236dd712fad8b7c340.tar.bz2
gsoc2013-evolution-26afa6081c3d9826dbae78236dd712fad8b7c340.tar.lz
gsoc2013-evolution-26afa6081c3d9826dbae78236dd712fad8b7c340.tar.xz
gsoc2013-evolution-26afa6081c3d9826dbae78236dd712fad8b7c340.tar.zst
gsoc2013-evolution-26afa6081c3d9826dbae78236dd712fad8b7c340.zip
Utilize the new ESourceSelector:primary-selection property.
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/gui/widgets/e-addressbook-selector.c74
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c4
-rw-r--r--addressbook/importers/evolution-csv-importer.c2
-rw-r--r--addressbook/importers/evolution-ldif-importer.c2
-rw-r--r--addressbook/importers/evolution-vcard-importer.c2
5 files changed, 19 insertions, 65 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;
diff --git a/addressbook/importers/evolution-csv-importer.c b/addressbook/importers/evolution-csv-importer.c
index 3e86679c96..970ada7fd6 100644
--- a/addressbook/importers/evolution-csv-importer.c
+++ b/addressbook/importers/evolution-csv-importer.c
@@ -727,7 +727,7 @@ static void
primary_selection_changed_cb (ESourceSelector *selector, EImportTarget *target)
{
g_datalist_set_data_full(&target->data, "csv-source",
- g_object_ref (e_source_selector_peek_primary_selection (selector)),
+ g_object_ref (e_source_selector_get_primary_selection (selector)),
g_object_unref);
}
diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c
index 246eebc9ee..15627bad5a 100644
--- a/addressbook/importers/evolution-ldif-importer.c
+++ b/addressbook/importers/evolution-ldif-importer.c
@@ -525,7 +525,7 @@ static void
primary_selection_changed_cb (ESourceSelector *selector, EImportTarget *target)
{
g_datalist_set_data_full(&target->data, "ldif-source",
- g_object_ref (e_source_selector_peek_primary_selection (selector)),
+ g_object_ref (e_source_selector_get_primary_selection (selector)),
g_object_unref);
}
diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c
index efdf3b362c..5cad56a767 100644
--- a/addressbook/importers/evolution-vcard-importer.c
+++ b/addressbook/importers/evolution-vcard-importer.c
@@ -385,7 +385,7 @@ static void
primary_selection_changed_cb (ESourceSelector *selector, EImportTarget *target)
{
g_datalist_set_data_full(&target->data, "vcard-source",
- g_object_ref (e_source_selector_peek_primary_selection (selector)),
+ g_object_ref (e_source_selector_get_primary_selection (selector)),
g_object_unref);
}