aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'modules/calendar')
-rw-r--r--modules/calendar/e-cal-shell-migrate.c24
-rw-r--r--modules/calendar/e-memo-shell-migrate.c26
-rw-r--r--modules/calendar/e-task-shell-migrate.c26
3 files changed, 37 insertions, 39 deletions
diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c
index d25228d98f..3ef6e554ad 100644
--- a/modules/calendar/e-cal-shell-migrate.c
+++ b/modules/calendar/e-cal-shell-migrate.c
@@ -43,6 +43,7 @@
#include "e-cal-shell-backend.h"
+#define LOCAL_BASE_URI "local:"
#define WEBCAL_BASE_URI "webcal://"
#define CONTACTS_BASE_URI "contacts://"
#define BAD_CONTACTS_BASE_URI "contact://"
@@ -80,8 +81,6 @@ create_calendar_sources (EShellBackend *shell_backend,
EShellSettings *shell_settings;
GSList *groups;
ESourceGroup *group;
- gchar *base_uri, *base_uri_proto;
- const gchar *base_dir;
*on_this_computer = NULL;
*on_the_web = NULL;
@@ -91,15 +90,14 @@ create_calendar_sources (EShellBackend *shell_backend,
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
- base_dir = e_shell_backend_get_data_dir (shell_backend);
- base_uri = g_build_filename (base_dir, "local", NULL);
-
- base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
-
groups = e_source_list_peek_groups (source_list);
if (groups) {
/* groups are already there, we need to search for things... */
GSList *g;
+ gchar *base_dir, *base_uri;
+
+ base_dir = g_build_filename (e_shell_backend_get_data_dir (shell_backend), "local", NULL);
+ base_uri = g_filename_to_uri (base_dir, NULL, NULL);
for (g = groups; g; g = g->next) {
@@ -109,9 +107,9 @@ create_calendar_sources (EShellBackend *shell_backend,
e_source_group_set_base_uri (group, CONTACTS_BASE_URI);
if (!strcmp (base_uri, e_source_group_peek_base_uri (group)))
- e_source_group_set_base_uri (group, base_uri_proto);
+ e_source_group_set_base_uri (group, LOCAL_BASE_URI);
- if (!*on_this_computer && !strcmp (base_uri_proto,
+ if (!*on_this_computer && !strcmp (LOCAL_BASE_URI,
e_source_group_peek_base_uri (group)))
*on_this_computer = g_object_ref (group);
@@ -123,6 +121,9 @@ create_calendar_sources (EShellBackend *shell_backend,
e_source_group_peek_base_uri (group)))
*contacts = g_object_ref (group);
}
+
+ g_free (base_dir);
+ g_free (base_uri);
}
if (*on_this_computer) {
@@ -144,7 +145,7 @@ create_calendar_sources (EShellBackend *shell_backend,
}
} 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 (source_list, group, -1);
*on_this_computer = group;
@@ -199,9 +200,6 @@ create_calendar_sources (EShellBackend *shell_backend,
*contacts = group;
}
-
- g_free (base_uri_proto);
- g_free (base_uri);
}
gboolean
diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c
index e4b5697c38..c64b8b086f 100644
--- a/modules/calendar/e-memo-shell-migrate.c
+++ b/modules/calendar/e-memo-shell-migrate.c
@@ -35,6 +35,7 @@
#include "e-memo-shell-backend.h"
+#define LOCAL_BASE_URI "local:"
#define WEBCAL_BASE_URI "webcal://"
#define PERSONAL_RELATIVE_URI "system"
#define GROUPWISE_BASE_URI "groupwise://"
@@ -50,8 +51,6 @@ create_memo_sources (EShellBackend *shell_backend,
EShellSettings *shell_settings;
GSList *groups;
ESourceGroup *group;
- gchar *base_uri, *base_uri_proto;
- const gchar *base_dir;
*on_this_computer = NULL;
*on_the_web = NULL;
@@ -60,25 +59,29 @@ create_memo_sources (EShellBackend *shell_backend,
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
- base_dir = e_shell_backend_get_data_dir (shell_backend);
- base_uri = g_build_filename (base_dir, "local", NULL);
-
- base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
-
groups = e_source_list_peek_groups (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 (e_shell_backend_get_data_dir (shell_backend), "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 (base_uri_proto, 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);
else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI, e_source_group_peek_base_uri (group)))
*on_the_web = g_object_ref (group);
}
+
+ g_free (base_dir);
+ g_free (base_uri);
}
if (*on_this_computer) {
@@ -100,7 +103,7 @@ create_memo_sources (EShellBackend *shell_backend,
}
} 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 (source_list, group, -1);
*on_this_computer = group;
@@ -148,9 +151,6 @@ create_memo_sources (EShellBackend *shell_backend,
*on_the_web = group;
}
-
- g_free (base_uri_proto);
- g_free (base_uri);
}
static gboolean
diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c
index fbfedb0617..f57ac7e75a 100644
--- a/modules/calendar/e-task-shell-migrate.c
+++ b/modules/calendar/e-task-shell-migrate.c
@@ -43,6 +43,7 @@
#include "e-task-shell-backend.h"
+#define LOCAL_BASE_URI "local:"
#define WEBCAL_BASE_URI "webcal://"
#define PERSONAL_RELATIVE_URI "system"
@@ -57,8 +58,6 @@ create_task_sources (EShellBackend *shell_backend,
EShellSettings *shell_settings;
GSList *groups;
ESourceGroup *group;
- gchar *base_uri, *base_uri_proto;
- const gchar *base_dir;
*on_this_computer = NULL;
*on_the_web = NULL;
@@ -67,27 +66,31 @@ create_task_sources (EShellBackend *shell_backend,
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
- base_dir = e_shell_backend_get_data_dir (shell_backend);
- base_uri = g_build_filename (base_dir, "local", NULL);
-
- base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
-
groups = e_source_list_peek_groups (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 (e_shell_backend_get_data_dir (shell_backend), "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 (base_uri_proto,
+ 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);
else if (!*on_the_web && !strcmp (WEBCAL_BASE_URI,
e_source_group_peek_base_uri (group)))
*on_the_web = g_object_ref (group);
}
+
+ g_free (base_dir);
+ g_free (base_uri);
}
if (*on_this_computer) {
@@ -109,7 +112,7 @@ create_task_sources (EShellBackend *shell_backend,
}
} 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 (source_list, group, -1);
*on_this_computer = group;
@@ -157,9 +160,6 @@ create_task_sources (EShellBackend *shell_backend,
*on_the_web = group;
}
-
- g_free (base_uri_proto);
- g_free (base_uri);
}
gboolean