aboutsummaryrefslogtreecommitdiffstats
path: root/modules/addressbook
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-11-24 20:37:15 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:41:04 +0800
commitaaf95d222df880565db862c953638dcb04e8dbb7 (patch)
tree42eabc993affc6cd2c3f7f9ecd098ceee0f38b22 /modules/addressbook
parente0cbce9595ea5d009776a4e7dd1c5c01616872c8 (diff)
downloadgsoc2013-evolution-aaf95d222df880565db862c953638dcb04e8dbb7.tar
gsoc2013-evolution-aaf95d222df880565db862c953638dcb04e8dbb7.tar.gz
gsoc2013-evolution-aaf95d222df880565db862c953638dcb04e8dbb7.tar.bz2
gsoc2013-evolution-aaf95d222df880565db862c953638dcb04e8dbb7.tar.lz
gsoc2013-evolution-aaf95d222df880565db862c953638dcb04e8dbb7.tar.xz
gsoc2013-evolution-aaf95d222df880565db862c953638dcb04e8dbb7.tar.zst
gsoc2013-evolution-aaf95d222df880565db862c953638dcb04e8dbb7.zip
Bug #632962 - Duplicate "On this computer" sources after update
Diffstat (limited to 'modules/addressbook')
-rw-r--r--modules/addressbook/e-book-shell-migrate.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/modules/addressbook/e-book-shell-migrate.c b/modules/addressbook/e-book-shell-migrate.c
index 7440564380..7b91a04cff 100644
--- a/modules/addressbook/e-book-shell-migrate.c
+++ b/modules/addressbook/e-book-shell-migrate.c
@@ -66,6 +66,7 @@ typedef struct {
GtkWidget *progress;
} MigrationContext;
+#define LOCAL_BASE_URI "local:"
#define LDAP_BASE_URI "ldap://"
#define PERSONAL_RELATIVE_URI "system"
@@ -77,27 +78,28 @@ create_groups (MigrationContext *context,
{
GSList *groups;
ESourceGroup *group;
- gchar *base_uri, *base_uri_proto;
*on_this_computer = NULL;
*on_ldap_servers = NULL;
*personal_source = NULL;
- base_uri = g_build_filename (context->data_dir, "local", NULL);
-
- base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
-
groups = e_source_list_peek_groups (context->source_list);
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 (context->data_dir, "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 (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 (base_uri_proto,
+ !strcmp (LOCAL_BASE_URI,
e_source_group_peek_base_uri (group)))
*on_this_computer = g_object_ref (group);
else if (!*on_ldap_servers &&
@@ -105,6 +107,9 @@ create_groups (MigrationContext *context,
e_source_group_peek_base_uri (group)))
*on_ldap_servers = g_object_ref (group);
}
+
+ g_free (base_dir);
+ g_free (base_uri);
}
if (*on_this_computer) {
@@ -127,7 +132,7 @@ create_groups (MigrationContext *context,
}
else {
/* create the local source group */
- group = e_source_group_new (_("On This Computer"), base_uri_proto);
+ group = e_source_group_new (_("On This Computer"), LOCAL_BASE_URI);
e_source_list_add_group (context->source_list, group, -1);
*on_this_computer = group;
@@ -150,9 +155,6 @@ create_groups (MigrationContext *context,
*on_ldap_servers = group;
}
-
- g_free (base_uri_proto);
- g_free (base_uri);
}
static MigrationContext *