diff options
author | Milan Crha <mcrha@redhat.com> | 2010-09-29 16:43:04 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-09-29 16:43:04 +0800 |
commit | 2a772badda42e30da739c944c29b80bcdbb58b1b (patch) | |
tree | c33783cc0baf51ae4a8376067ad410bad4831553 /addressbook | |
parent | 278241c9e21789b23d77adbd0cd8945c695c4a0b (diff) | |
download | gsoc2013-evolution-2a772badda42e30da739c944c29b80bcdbb58b1b.tar.gz gsoc2013-evolution-2a772badda42e30da739c944c29b80bcdbb58b1b.tar.zst gsoc2013-evolution-2a772badda42e30da739c944c29b80bcdbb58b1b.zip |
Bug #629636 - Doesn't recognize local ESource-s
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/gui/widgets/eab-gui-util.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index 4cf5219e71..a40a3a3ff5 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -74,11 +74,30 @@ eab_load_error_dialog (GtkWidget *parent, ESource *source, const GError *error) "to download its contents."); } - else if (uri && !strncmp (uri, "file:", 5)) { - gchar *path = g_filename_from_uri (uri, NULL, NULL); + else if (uri && g_str_has_prefix (uri, "local:")) { + const gchar *user_data_dir; + const gchar *source_dir; + gchar *mangled_source_dir; + gchar *path; + + user_data_dir = e_get_user_data_dir (); + source_dir = e_source_peek_relative_uri (source); + + if (!source_dir || !g_str_equal (source_dir, "system")) + source_dir = e_source_peek_uid (source); + + /* Mangle the URI to not contain invalid characters. */ + mangled_source_dir = g_strdelimit (g_strdup (source_dir), ":/", '_'); + + path = g_build_filename ( + user_data_dir, "addressbook", mangled_source_dir, NULL); + + g_free (mangled_source_dir); + label = g_strdup_printf ( _("This address book cannot be opened. Please check that the " "path %s exists and that permissions are set to access it."), path); + g_free (path); label_string = label; } |