From e5711b4dd2f7bc084d453cba8d78e7b656a40a67 Mon Sep 17 00:00:00 2001 From: Sivaiah Nallagatla Date: Tue, 22 Feb 2005 00:54:00 +0000 Subject: update the base uri of the "On This Computer" group when user home dir 2005-02-19 Sivaiah Nallagatla * gui/component/addressbook-component.c (ensure_sources) : update the base uri of the "On This Computer" group when user home dir changes. Also unref personal source if created here. Fixes #67724 svn path=/trunk/; revision=28838 --- addressbook/ChangeLog | 9 +++++++++ addressbook/gui/component/addressbook-component.c | 18 ++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 030ae85cec..80d96b4418 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,12 @@ +2005-02-19 Sivaiah Nallagatla + + * gui/component/addressbook-component.c + (ensure_sources) : update the base uri + of the "On This Computer" group when user home dir + changes. Also unref personal source if created here. + + Fixes #67724 + 2005-02-09 Sivaiah Nallagatla * gui/component/addressbook-config.c diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index a0c3c58c04..fdcb4c9c9d 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -95,7 +95,10 @@ ensure_sources (AddressbookComponent *component) group = E_SOURCE_GROUP (g->data); - if (!on_this_computer && !strcmp (base_uri_proto, e_source_group_peek_base_uri (group))) + /* compare only file:// part. If user home dir name changes we do not want to create + one more group */ + + if (!on_this_computer && !strncmp (base_uri_proto, e_source_group_peek_base_uri (group), 7)) on_this_computer = group; else if (!on_ldap_servers && !strcmp (LDAP_BASE_URI, e_source_group_peek_base_uri (group))) on_ldap_servers = group; @@ -114,6 +117,16 @@ ensure_sources (AddressbookComponent *component) break; } } + /* Make sure we have the correct base uri. This can change when user's + homedir name changes */ + if (strcmp (base_uri_proto, e_source_group_peek_base_uri (on_this_computer))) { + e_source_group_set_base_uri (on_this_computer, base_uri_proto); + + /* *sigh* . We shouldn't need this sync call here as set_base_uri + call results in synching to gconf, but that happens in idle loop + and too late to prevent user seeing "Can not Open ... because of invalid uri" error.*/ + e_source_list_sync (source_list,NULL); + } } else { /* create the local source group */ @@ -138,7 +151,8 @@ ensure_sources (AddressbookComponent *component) on_ldap_servers = group; } - + if (personal_source) + g_object_unref (personal_source); g_free (base_uri_proto); g_free (base_uri); } -- cgit v1.2.3