aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog4
-rw-r--r--calendar/gui/migration.c33
-rw-r--r--calendar/gui/migration.h1
-rw-r--r--calendar/gui/tasks-component.c16
4 files changed, 41 insertions, 13 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index a72010410d..85d0d3d454 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -20,9 +20,9 @@
* gui/e-cal-view.c: add new signal "selected_time_changed"
* gui/e-day-view-main-item.c (e_day_view_main_item_class_init):
- a11y initialization
+ a11y initialization
* gui/e-day-view-top-item (e_day_view_top_item_get_day_label):
- new public function.
+ new public function.
* gui/e-day-view.c (e_day_view_ensure_rows_visible,
e_day_view_update_calendar_selection_time): make static functions public
(e_day_view_cursor_key_up, e_day_view_cursor_key_down,
diff --git a/calendar/gui/migration.c b/calendar/gui/migration.c
index be93309f1f..6dc16b8714 100644
--- a/calendar/gui/migration.c
+++ b/calendar/gui/migration.c
@@ -28,7 +28,7 @@
static gboolean
process_calendar_dir (ESourceGroup *source_group, const char *path,
- const char *name, const char *base_uri)
+ const char *filename, const char *name, const char *base_uri)
{
char *s;
GnomeVFSURI *from, *to;
@@ -37,7 +37,7 @@ process_calendar_dir (ESourceGroup *source_group, const char *path,
GDir *dir;
gboolean retval = TRUE;
- s = g_build_filename (path, "calendar.ics", NULL);
+ s = g_build_filename (path, filename, NULL);
if (!g_file_test (s, G_FILE_TEST_EXISTS)) {
g_free (s);
return FALSE;
@@ -50,7 +50,7 @@ process_calendar_dir (ESourceGroup *source_group, const char *path,
return FALSE;
s = g_build_filename (e_source_group_peek_base_uri (source_group), base_uri,
- "calendar.ics", NULL);
+ filename, NULL);
if (e_mkdir_hier (s, 0700) != 0) {
gnome_vfs_uri_unref (from);
g_free (s);
@@ -88,7 +88,7 @@ process_calendar_dir (ESourceGroup *source_group, const char *path,
while ((name = g_dir_read_name (dir))) {
tmp_s = g_build_filename (s, name, NULL);
if (g_file_test (tmp_s, G_FILE_TEST_IS_DIR)) {
- retval = process_calendar_dir (source_group, tmp_s, name, name);
+ retval = process_old_dir (source_group, tmp_s, filename, name, name);
}
g_free (tmp_s);
@@ -119,7 +119,30 @@ migrate_old_calendars (ESourceGroup *source_group)
/* look for the top-level calendar */
path = g_build_filename (g_get_home_dir (), "evolution/local/Calendar", NULL);
- retval = process_calendar_dir (source_group, path, _("Personal"), "Personal");
+ retval = process_old_dir (source_group, path, "calendar.ics", _("Personal"), "Personal");
+ g_free (path);
+
+ return retval;
+}
+
+gboolean
+migrate_old_tasks (ESourceGroup *source_group)
+{
+ char *path;
+ gboolean retval;
+
+ g_return_val_if_fail (E_IS_SOURCE_GROUP (source_group), FALSE);
+
+ path = g_build_filename (g_get_home_dir (), "evolution", NULL);
+ if (!g_file_test (path, G_FILE_TEST_IS_DIR)) {
+ g_free (path);
+ return FALSE;
+ }
+ g_free (path);
+
+ /* look for the top-level calendar */
+ path = g_build_filename (g_get_home_dir (), "evolution/local/Tasks", NULL);
+ retval = process_old_dir (source_group, path, "tasks.ics", _("Personal"), "Personal");
g_free (path);
return retval;
diff --git a/calendar/gui/migration.h b/calendar/gui/migration.h
index 2453d47abd..3d0f9a04b1 100644
--- a/calendar/gui/migration.h
+++ b/calendar/gui/migration.h
@@ -26,5 +26,6 @@
#include <e-util/e-source-group.h>
gboolean migrate_old_calendars (ESourceGroup *source_group);
+gboolean migrate_old_tasks (ESourceGroup *source_group);
#endif
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index a6b7062b9c..4e5de7c692 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -305,14 +305,18 @@ tasks_component_init (TasksComponent *component, TasksComponentClass *klass)
group = e_source_group_new (_("On This Computer"), base_uri);
e_source_list_add_group (priv->source_list, group, -1);
- /* FIXME: migrate tasks from older setups */
- new_dir = g_build_filename (base_uri, "Personal/", NULL);
- if (!e_mkdir_hier (new_dir, 0700)) {
- source = e_source_new (_("Personal"), "Personal");
- e_source_group_add_source (group, source, -1);
+ /* migrate tasks from older setup */
+ if (!migrate_old_tasks (group)) {
+ /* create default tasks folders */
+ new_dir = g_build_filename (base_uri, "Personal/", NULL);
+ if (!e_mkdir_hier (new_dir, 0700)) {
+ source = e_source_new (_("Personal"), "Personal");
+ e_source_group_add_source (group, source, -1);
+ }
+
+ g_free (new_dir);
}
- g_free (new_dir);
g_free (base_uri);
}