diff options
author | Milan Crha <mcrha@redhat.com> | 2010-11-24 20:37:15 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:04 +0800 |
commit | aaf95d222df880565db862c953638dcb04e8dbb7 (patch) | |
tree | 42eabc993affc6cd2c3f7f9ecd098ceee0f38b22 /capplet/settings | |
parent | e0cbce9595ea5d009776a4e7dd1c5c01616872c8 (diff) | |
download | gsoc2013-evolution-aaf95d222df880565db862c953638dcb04e8dbb7.tar.gz gsoc2013-evolution-aaf95d222df880565db862c953638dcb04e8dbb7.tar.zst gsoc2013-evolution-aaf95d222df880565db862c953638dcb04e8dbb7.zip |
Bug #632962 - Duplicate "On this computer" sources after update
Diffstat (limited to 'capplet/settings')
-rw-r--r-- | capplet/settings/mail-capplet-shell.c | 24 |
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); } |