aboutsummaryrefslogtreecommitdiffstats
path: root/capplet
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-11-24 20:37:15 +0800
committerMilan Crha <mcrha@redhat.com>2010-11-24 20:37:15 +0800
commit51d17b48e4ba74c17cc0ac30f9e956cdb380be9b (patch)
tree3c019efefcaa9e24c221c740ec7ff80a0f07b7f0 /capplet
parent64966f87895156b441738a617d66297f492d4cb2 (diff)
downloadgsoc2013-evolution-51d17b48e4ba74c17cc0ac30f9e956cdb380be9b.tar.gz
gsoc2013-evolution-51d17b48e4ba74c17cc0ac30f9e956cdb380be9b.tar.zst
gsoc2013-evolution-51d17b48e4ba74c17cc0ac30f9e956cdb380be9b.zip
Bug #632962 - Duplicate "On this computer" sources after update
Diffstat (limited to 'capplet')
-rw-r--r--capplet/settings/mail-capplet-shell.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/capplet/settings/mail-capplet-shell.c b/capplet/settings/mail-capplet-shell.c
index beb5206093..33c921d892 100644
--- a/capplet/settings/mail-capplet-shell.c
+++ b/capplet/settings/mail-capplet-shell.c
@@ -293,21 +293,18 @@ mail_capplet_shell_new (gint socket_id, gboolean just_druid, gboolean main_loop)
return GTK_WIDGET (shell);
}
+#define LOCAL_BASE_URI "local:"
#define PERSONAL_RELATIVE_URI "system"
static void
-setup_abooks ()
+setup_abooks (void)
{
- gchar *base_dir, *uri;
GSList *groups;
ESourceGroup *group;
ESourceList *list = NULL;
ESourceGroup *on_this_computer = NULL;
ESource *personal_source = NULL;
- base_dir = g_build_filename (e_get_user_data_dir (), "addressbook", "local", NULL);
- uri = g_filename_to_uri (base_dir, NULL, NULL);
-
if (!e_book_get_addressbooks (&list, NULL)) {
g_warning ("Unable to get books\n");
return;
@@ -317,16 +314,25 @@ setup_abooks ()
if (groups) {
/* groups are already there, we need to search for things... */
GSList *g;
+ gchar *base_dir, *base_uri;
- for (g = groups; g; g = g->next) {
+ base_dir = g_build_filename (e_get_user_data_dir (), "addressbook", "local", NULL);
+ base_uri = g_filename_to_uri (base_dir, NULL, NULL);
+ for (g = groups; g; g = g->next) {
group = E_SOURCE_GROUP (g->data);
- if (!on_this_computer && !strcmp (uri, e_source_group_peek_base_uri (group))) {
+ if (strcmp (base_uri, e_source_group_peek_base_uri (group)) == 0)
+ e_source_group_set_base_uri (group, LOCAL_BASE_URI);
+
+ if (!on_this_computer && !strcmp (LOCAL_BASE_URI, e_source_group_peek_base_uri (group))) {
on_this_computer = g_object_ref (group);
break;
}
}
+
+ g_free (base_dir);
+ g_free (base_uri);
}
if (on_this_computer) {
@@ -349,7 +355,7 @@ setup_abooks ()
}
else {
/* create the local source group */
- group = e_source_group_new (_("On This Computer"), uri);
+ group = e_source_group_new (_("On This Computer"), LOCAL_BASE_URI);
e_source_list_add_group (list, group, -1);
on_this_computer = group;
@@ -372,7 +378,5 @@ setup_abooks ()
e_source_list_sync (list, NULL);
g_object_unref (list);
- g_free (uri);
- g_free (base_dir);
}