aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-09-29 16:43:04 +0800
committerMilan Crha <mcrha@redhat.com>2010-09-29 16:43:04 +0800
commit2a772badda42e30da739c944c29b80bcdbb58b1b (patch)
treec33783cc0baf51ae4a8376067ad410bad4831553
parent278241c9e21789b23d77adbd0cd8945c695c4a0b (diff)
downloadgsoc2013-evolution-2a772badda42e30da739c944c29b80bcdbb58b1b.tar
gsoc2013-evolution-2a772badda42e30da739c944c29b80bcdbb58b1b.tar.gz
gsoc2013-evolution-2a772badda42e30da739c944c29b80bcdbb58b1b.tar.bz2
gsoc2013-evolution-2a772badda42e30da739c944c29b80bcdbb58b1b.tar.lz
gsoc2013-evolution-2a772badda42e30da739c944c29b80bcdbb58b1b.tar.xz
gsoc2013-evolution-2a772badda42e30da739c944c29b80bcdbb58b1b.tar.zst
gsoc2013-evolution-2a772badda42e30da739c944c29b80bcdbb58b1b.zip
Bug #629636 - Doesn't recognize local ESource-s
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c23
-rw-r--r--calendar/gui/dialogs/calendar-setup.c2
-rw-r--r--mail/em-utils.c2
-rw-r--r--modules/addressbook/addressbook-config.c4
4 files changed, 25 insertions, 6 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;
}
diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c
index b21c027fe1..5df14cf368 100644
--- a/calendar/gui/dialogs/calendar-setup.c
+++ b/calendar/gui/dialogs/calendar-setup.c
@@ -259,7 +259,7 @@ eccp_general_offline (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidg
const gchar *offline_sync;
guint row;
const gchar *base_uri = e_source_group_peek_base_uri (sdialog->source_group);
- gboolean is_local = base_uri && (g_str_has_prefix (base_uri, "file://") || g_str_has_prefix (base_uri, "contacts://"));
+ gboolean is_local = base_uri && (g_str_has_prefix (base_uri, "local:") || g_str_has_prefix (base_uri, "contacts://"));
offline_sync = e_source_get_property (sdialog->source, "offline_sync");
if (old)
return old;
diff --git a/mail/em-utils.c b/mail/em-utils.c
index cf00c73a28..c7b7020b4b 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1703,7 +1703,7 @@ search_address_in_addressbooks (const gchar *address, gboolean local_only, gbool
if (!group)
continue;
- if (local_only && !(e_source_group_peek_base_uri (group) && g_str_has_prefix (e_source_group_peek_base_uri (group), "file://")))
+ if (local_only && !(e_source_group_peek_base_uri (group) && g_str_has_prefix (e_source_group_peek_base_uri (group), "local:")))
continue;
for (s = e_source_group_peek_sources (group); s; s = g_slist_next (s)) {
diff --git a/modules/addressbook/addressbook-config.c b/modules/addressbook/addressbook-config.c
index b275590cf5..0c0bda4753 100644
--- a/modules/addressbook/addressbook-config.c
+++ b/modules/addressbook/addressbook-config.c
@@ -609,7 +609,7 @@ eabc_general_use_in_cal (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkW
if (group)
base_uri = e_source_group_peek_base_uri (group);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (use_in_cal_setting), (use_in_cal && g_str_equal (use_in_cal, "1")) || (!use_in_cal && base_uri && g_str_has_prefix (base_uri, "file://")));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (use_in_cal_setting), (use_in_cal && g_str_equal (use_in_cal, "1")) || (!use_in_cal && base_uri && g_str_has_prefix (base_uri, "local:")));
g_signal_connect (use_in_cal_setting, "toggled", G_CALLBACK (use_in_cal_changed_cb), sdialog);
@@ -630,7 +630,7 @@ eabc_general_offline (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidg
const gchar *offline_sync;
gboolean is_local_book;
- is_local_book = g_str_has_prefix (e_source_group_peek_base_uri (sdialog->source_group), "file:");
+ is_local_book = g_str_has_prefix (e_source_group_peek_base_uri (sdialog->source_group), "local:");
offline_sync = e_source_get_property (sdialog->source, "offline_sync");
if (old)
return old;