From 89557dcfee7bb9f7ca7dddfe559e89dc7b2a93df Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Tue, 23 Nov 2010 01:58:24 +0530 Subject: Migrate the local store from mbox to maildir format --- shell/e-shell-migrate.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'shell/e-shell-migrate.c') diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index f4ac0b7de5..3f3f6f563b 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -822,11 +822,8 @@ e_shell_migrate_attempt (EShell *shell) if (curr_major <= 2 && curr_minor <= 30) fix_folder_permissions (e_get_user_data_dir ()); - if (!(curr_major > major || - (curr_major == major && curr_minor > minor) || - (curr_major == major && curr_minor == minor && curr_micro > micro))) - goto check_old; - + /* Attempt to run migration all the time and let the backend + make the choice */ if (!shell_migrate_attempt (shell, major, minor, micro)) _exit (EXIT_SUCCESS); @@ -837,9 +834,6 @@ e_shell_migrate_attempt (EShell *shell) g_free (string); migrated = TRUE; - -check_old: - key = GCONF_LAST_VERSION_KEY; /* Try to retrieve the last migrated version from GConf. */ -- cgit v1.2.3 From 89f4d51b10b78379e09364bc872868758b968078 Mon Sep 17 00:00:00 2001 From: Mathieu Trudel-Lapierre Date: Tue, 23 Nov 2010 10:46:54 +0100 Subject: Bug #635087 - Leftover files after migration of config/data/cache to XDG directories --- shell/e-shell-migrate.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'shell/e-shell-migrate.c') diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index 3f3f6f563b..878b121488 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -433,14 +433,15 @@ shell_xdg_migrate_config_dir_mail (EShell *shell, } static void -shell_xdg_migrate_config_dir_cleanup (EShell *shell, +shell_xdg_migrate_dir_cleanup (EShell *shell, const gchar *old_base_dir, - const gchar *backend_name) + const gchar *backend_name, + const gchar *dir_name) { gchar *dirname; dirname = g_build_filename ( - old_base_dir, backend_name, "config", NULL); + old_base_dir, backend_name, dir_name, NULL); shell_xdg_migrate_rmdir (dirname); @@ -467,10 +468,13 @@ shell_xdg_migrate_config_dir (EShell *shell, /* Handle backend-specific files. */ shell_xdg_migrate_config_dir_mail (shell, old_base_dir); - /* Remove leftover "config" directories. */ - for (ii = 0; shell_backend_names[ii] != NULL; ii++) - shell_xdg_migrate_config_dir_cleanup ( - shell, old_base_dir, shell_backend_names[ii]); + /* Remove leftover config directories. */ + for (ii = 0; shell_backend_names[ii] != NULL; ii++) { + shell_xdg_migrate_dir_cleanup ( + shell, old_base_dir, shell_backend_names[ii], "config"); + shell_xdg_migrate_dir_cleanup ( + shell, old_base_dir, shell_backend_names[ii], "views"); + } /*** Miscellaneous configuration files. ***/ -- cgit v1.2.3 From f3c11101c3c58a154c005a936a6b99671401986d Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 3 Mar 2011 11:26:41 +0100 Subject: Merge duplicate local sources --- shell/e-shell-migrate.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) (limited to 'shell/e-shell-migrate.c') diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index 878b121488..01b3f9f10e 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -793,6 +793,87 @@ fix_folder_permissions (const gchar *data_dir) change_dir_modes (data_dir); } +static void +merge_duplicate_local_sources (GConfClient *client, const gchar *gconf_key) +{ + ESourceList *source_list; + GSList *iter, *to_remove = NULL; + ESourceGroup *first_local = NULL; + + g_return_if_fail (client != NULL); + g_return_if_fail (gconf_key != NULL); + + source_list = e_source_list_new_for_gconf (client, gconf_key); + + for (iter = e_source_list_peek_groups (source_list); iter; iter = iter->next) { + GSList *sources; + ESourceGroup *group = iter->data; + + if (!group || !e_source_group_peek_base_uri (group) + || g_ascii_strncasecmp (e_source_group_peek_base_uri (group), "local:", 6) != 0) + continue; + + if (!first_local) { + first_local = group; + continue; + } + + /* merging respective sources */ + for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) { + GSList *liter; + ESource *dupe_source = sources->data; + + if (!dupe_source) + continue; + + for (liter = e_source_group_peek_sources (first_local); liter != NULL; liter = liter->next) { + ESource *my_source = liter->data; + const gchar *val1, *val2; + + if (!my_source) + continue; + + /* pretty unlikely, but just in case */ + val1 = e_source_peek_uid (dupe_source); + val2 = e_source_peek_uid (my_source); + if (g_strcmp0 (val1, val2) == 0) + break; + + /* relative uri should not be empty (but adressbook can have it empty) */ + val1 = e_source_peek_relative_uri (dupe_source); + val2 = e_source_peek_relative_uri (my_source); + if (g_strcmp0 (val1, val2) == 0 && val1 && *val1) + break; + } + + /* didn't find matching source, thus add its copy */ + if (liter == NULL) { + ESource *copy; + + copy = e_source_copy (dupe_source); + e_source_group_add_source (first_local, copy, -1); + g_object_unref (copy); + } + } + + to_remove = g_slist_prepend (to_remove, group); + } + + if (!to_remove) { + g_object_unref (source_list); + return; + } + + for (iter = to_remove; iter; iter = iter->next) { + e_source_list_remove_group (source_list, iter->data); + } + + e_source_list_sync (source_list, NULL); + + g_object_unref (source_list); + g_slist_free (to_remove); +} + gboolean e_shell_migrate_attempt (EShell *shell) { @@ -831,6 +912,13 @@ e_shell_migrate_attempt (EShell *shell) if (!shell_migrate_attempt (shell, major, minor, micro)) _exit (EXIT_SUCCESS); + /* The 2.32.x (except of 2.32.2) lefts duplicate On This Computer/Personal sources, + thus clean the mess up */ + merge_duplicate_local_sources (client, "/apps/evolution/addressbook/sources"); + merge_duplicate_local_sources (client, "/apps/evolution/calendar/sources"); + merge_duplicate_local_sources (client, "/apps/evolution/tasks/sources"); + merge_duplicate_local_sources (client, "/apps/evolution/memos/sources"); + /* Record a successful migration. */ string = g_strdup_printf ( "%d.%d.%d", curr_major, curr_minor, curr_micro); -- cgit v1.2.3 From 7aacf983b32ecac26bc9707697da622b3ef164a3 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 5 Mar 2011 12:33:49 -0500 Subject: Coding style and whitespace cleanup. --- shell/e-shell-migrate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'shell/e-shell-migrate.c') diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index 01b3f9f10e..fbcd701bea 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -819,14 +819,16 @@ merge_duplicate_local_sources (GConfClient *client, const gchar *gconf_key) } /* merging respective sources */ - for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) { + for (sources = e_source_group_peek_sources (group); + sources != NULL; sources = sources->next) { GSList *liter; ESource *dupe_source = sources->data; if (!dupe_source) continue; - for (liter = e_source_group_peek_sources (first_local); liter != NULL; liter = liter->next) { + for (liter = e_source_group_peek_sources (first_local); + liter != NULL; liter = liter->next) { ESource *my_source = liter->data; const gchar *val1, *val2; -- cgit v1.2.3 From 3b641d44e6059ac462c23124638c1bc21c9f5b80 Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Mon, 7 Mar 2011 08:14:00 +0100 Subject: Typo in comment: s/datefime-formats/datetime-formats/ --- shell/e-shell-migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shell/e-shell-migrate.c') diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index fbcd701bea..dbed197dce 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -481,7 +481,7 @@ shell_xdg_migrate_config_dir (EShell *shell, old_config_dir = old_base_dir; new_config_dir = e_get_user_config_dir (); - /* Subtle name change: datetime-formats --> datefime-formats.ini */ + /* Subtle name change: datetime-formats --> datetime-formats.ini */ old_filename = g_build_filename (old_config_dir, "datetime-formats", NULL); new_filename = g_build_filename (new_config_dir, "datetime-formats.ini", NULL); shell_xdg_migrate_rename (old_filename, new_filename); -- cgit v1.2.3 From cb7d85c41a7d47b87c5ff6f3cdb508efda68d85f Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 7 Mar 2011 12:32:32 +0100 Subject: Bug #644107 - Local addressbooks created without relative_uri set --- shell/e-shell-migrate.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'shell/e-shell-migrate.c') diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index dbed197dce..41d829b9e6 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -819,16 +819,14 @@ merge_duplicate_local_sources (GConfClient *client, const gchar *gconf_key) } /* merging respective sources */ - for (sources = e_source_group_peek_sources (group); - sources != NULL; sources = sources->next) { + for (sources = e_source_group_peek_sources (group); sources != NULL; sources = sources->next) { GSList *liter; ESource *dupe_source = sources->data; if (!dupe_source) continue; - for (liter = e_source_group_peek_sources (first_local); - liter != NULL; liter = liter->next) { + for (liter = e_source_group_peek_sources (first_local); liter != NULL; liter = liter->next) { ESource *my_source = liter->data; const gchar *val1, *val2; @@ -861,6 +859,22 @@ merge_duplicate_local_sources (GConfClient *client, const gchar *gconf_key) to_remove = g_slist_prepend (to_remove, group); } + if (first_local) { + GSList *sources; + + for (sources = e_source_group_peek_sources (first_local); sources != NULL; sources = sources->next) { + ESource *source = sources->data; + const gchar *relative_uri; + + if (!source) + continue; + + relative_uri = e_source_peek_relative_uri (source); + if (!relative_uri || !*relative_uri) + e_source_set_relative_uri (source, e_source_peek_uid (source)); + } + } + if (!to_remove) { g_object_unref (source_list); return; -- cgit v1.2.3 From 578214584caa7805edca09b27e2306dc31d80fb6 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 7 May 2011 12:22:36 -0400 Subject: Whitespace and coding style cleanups. --- shell/e-shell-migrate.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'shell/e-shell-migrate.c') diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index 41d829b9e6..6874c2e304 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -809,8 +809,9 @@ merge_duplicate_local_sources (GConfClient *client, const gchar *gconf_key) GSList *sources; ESourceGroup *group = iter->data; - if (!group || !e_source_group_peek_base_uri (group) - || g_ascii_strncasecmp (e_source_group_peek_base_uri (group), "local:", 6) != 0) + if (!group || !e_source_group_peek_base_uri (group) || + g_ascii_strncasecmp ( + e_source_group_peek_base_uri (group), "local:", 6) != 0) continue; if (!first_local) { @@ -819,14 +820,16 @@ merge_duplicate_local_sources (GConfClient *client, const gchar *gconf_key) } /* merging respective sources */ - for (sources = e_source_group_peek_sources (group); sources != NULL; sources = sources->next) { + for (sources = e_source_group_peek_sources (group); + sources != NULL; sources = sources->next) { GSList *liter; ESource *dupe_source = sources->data; if (!dupe_source) continue; - for (liter = e_source_group_peek_sources (first_local); liter != NULL; liter = liter->next) { + for (liter = e_source_group_peek_sources (first_local); + liter != NULL; liter = liter->next) { ESource *my_source = liter->data; const gchar *val1, *val2; @@ -862,7 +865,8 @@ merge_duplicate_local_sources (GConfClient *client, const gchar *gconf_key) if (first_local) { GSList *sources; - for (sources = e_source_group_peek_sources (first_local); sources != NULL; sources = sources->next) { + for (sources = e_source_group_peek_sources (first_local); + sources != NULL; sources = sources->next) { ESource *source = sources->data; const gchar *relative_uri; -- cgit v1.2.3 From c24038c4f62f37b89d1bda9542ca5ccc843d4ea0 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 27 May 2011 15:23:07 +0200 Subject: Bug #646109 - Fix use of include to make sure translations work --- shell/e-shell-migrate.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'shell/e-shell-migrate.c') diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index 6874c2e304..5863e1c4a0 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -19,6 +19,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include "e-shell-migrate.h" #include -- cgit v1.2.3 From e7954c3f251aabbf95d099159709c8c66dfedc44 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 4 Jun 2011 15:53:10 -0500 Subject: Coding style and whitespace cleanups. --- shell/e-shell-migrate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'shell/e-shell-migrate.c') diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index 5863e1c4a0..f5e1174729 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -846,7 +846,8 @@ merge_duplicate_local_sources (GConfClient *client, const gchar *gconf_key) if (g_strcmp0 (val1, val2) == 0) break; - /* relative uri should not be empty (but adressbook can have it empty) */ + /* relative uri should not be empty + * (but adressbook can have it empty) */ val1 = e_source_peek_relative_uri (dupe_source); val2 = e_source_peek_relative_uri (my_source); if (g_strcmp0 (val1, val2) == 0 && val1 && *val1) -- cgit v1.2.3 From 777c1cbd40eb63365f2c28e38f6a93beb2d1c9d1 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 16 Aug 2011 11:25:56 -0400 Subject: Coding style and whitespace cleanup. --- shell/e-shell-migrate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'shell/e-shell-migrate.c') diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index f5e1174729..89f94b0f83 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -798,7 +798,8 @@ fix_folder_permissions (const gchar *data_dir) } static void -merge_duplicate_local_sources (GConfClient *client, const gchar *gconf_key) +merge_duplicate_local_sources (GConfClient *client, + const gchar *gconf_key) { ESourceList *source_list; GSList *iter, *to_remove = NULL; @@ -933,12 +934,12 @@ e_shell_migrate_attempt (EShell *shell) fix_folder_permissions (e_get_user_data_dir ()); /* Attempt to run migration all the time and let the backend - make the choice */ + * make the choice */ if (!shell_migrate_attempt (shell, major, minor, micro)) _exit (EXIT_SUCCESS); /* The 2.32.x (except of 2.32.2) lefts duplicate On This Computer/Personal sources, - thus clean the mess up */ + * thus clean the mess up */ merge_duplicate_local_sources (client, "/apps/evolution/addressbook/sources"); merge_duplicate_local_sources (client, "/apps/evolution/calendar/sources"); merge_duplicate_local_sources (client, "/apps/evolution/tasks/sources"); -- cgit v1.2.3 From d4e8e2f809d4da7dd5ac0b53a7900e5bd39777f9 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Thu, 13 Oct 2011 16:53:51 +0200 Subject: Migrate most of the shell code to GSettings --- shell/e-shell-migrate.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'shell/e-shell-migrate.c') diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index dd75a40b82..e694ec29fd 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -38,9 +38,6 @@ #include "es-event.h" -#define GCONF_VERSION_KEY "/apps/evolution/version" -#define GCONF_LAST_VERSION_KEY "/apps/evolution/last_version" - /******************** Begin XDG Base Directory Migration ********************/ /* These are the known EShellBackend names as of Evolution 3.0 */ static const gchar *shell_backend_names[] = @@ -735,23 +732,23 @@ shell_migrate_get_version (EShell *shell, gint *minor, gint *micro) { - GConfClient *client; - const gchar *key; + GSettings *settings; gchar *string; *major = 0; *minor = 0; *micro = 0; - key = GCONF_VERSION_KEY; - client = e_shell_get_gconf_client (shell); - string = gconf_client_get_string (client, key, NULL); + settings = g_settings_new ("org.gnome.evolution"); + string = g_settings_get_string (settings, "version"); if (string != NULL) { /* Since 1.4.0 we've kept the version key in GConf. */ sscanf (string, "%d.%d.%d", major, minor, micro); g_free (string); } + + g_object_unref (settings); } static void @@ -902,7 +899,7 @@ gboolean e_shell_migrate_attempt (EShell *shell) { ESEvent *ese; - GConfClient *client; + GSettings *settings; const gchar *key; gint major, minor, micro; gint last_major, last_minor, last_micro; @@ -912,7 +909,7 @@ e_shell_migrate_attempt (EShell *shell) g_return_val_if_fail (E_IS_SHELL (shell), FALSE); - client = e_shell_get_gconf_client (shell); + settings = g_settings_new ("org.gnome.evolution"); if (sscanf (BASE_VERSION, "%d.%d", &curr_major, &curr_minor) != 2) { g_warning ("Could not parse BASE_VERSION (%s)", BASE_VERSION); @@ -946,14 +943,13 @@ e_shell_migrate_attempt (EShell *shell) /* Record a successful migration. */ string = g_strdup_printf ( "%d.%d.%d", curr_major, curr_minor, curr_micro); - gconf_client_set_string (client, GCONF_VERSION_KEY, string, NULL); + g_settings_set_string (settings, "version", string); g_free (string); migrated = TRUE; - key = GCONF_LAST_VERSION_KEY; - /* Try to retrieve the last migrated version from GConf. */ - string = gconf_client_get_string (client, key, NULL); + /* Try to retrieve the last migrated version from GSettings. */ + string = g_settings_get_string (client, "last-upgraded-version"); if (migrated || string == NULL || sscanf (string, "%d.%d.%d", &last_major, &last_minor, &last_micro) != 3) { last_major = major; @@ -964,9 +960,11 @@ e_shell_migrate_attempt (EShell *shell) string = g_strdup_printf ( "%d.%d.%d", last_major, last_minor, last_micro); - gconf_client_set_string (client, key, string, NULL); + g_settings_set_string (client, "last-upgraded-version", string); g_free (string); + g_object_unref (settings); + /** @Event: Shell attempted upgrade * @Id: upgrade.done * @Target: ESMenuTargetState -- cgit v1.2.3 From 2dd62937f02126c75c401fce50c6444a376e2f9f Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Thu, 13 Oct 2011 17:23:54 +0200 Subject: Build fixes --- shell/e-shell-migrate.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'shell/e-shell-migrate.c') diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index e694ec29fd..1931011516 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -900,6 +900,7 @@ e_shell_migrate_attempt (EShell *shell) { ESEvent *ese; GSettings *settings; + GConfClient *client; const gchar *key; gint major, minor, micro; gint last_major, last_minor, last_micro; @@ -935,10 +936,12 @@ e_shell_migrate_attempt (EShell *shell) /* The 2.32.x (except of 2.32.2) lefts duplicate On This Computer/Personal sources, * thus clean the mess up */ + client = gconf_client_get_default (); merge_duplicate_local_sources (client, "/apps/evolution/addressbook/sources"); merge_duplicate_local_sources (client, "/apps/evolution/calendar/sources"); merge_duplicate_local_sources (client, "/apps/evolution/tasks/sources"); merge_duplicate_local_sources (client, "/apps/evolution/memos/sources"); + g_object_unref (client); /* Record a successful migration. */ string = g_strdup_printf ( @@ -949,7 +952,7 @@ e_shell_migrate_attempt (EShell *shell) migrated = TRUE; /* Try to retrieve the last migrated version from GSettings. */ - string = g_settings_get_string (client, "last-upgraded-version"); + string = g_settings_get_string (settings, "last-upgraded-version"); if (migrated || string == NULL || sscanf (string, "%d.%d.%d", &last_major, &last_minor, &last_micro) != 3) { last_major = major; @@ -960,7 +963,7 @@ e_shell_migrate_attempt (EShell *shell) string = g_strdup_printf ( "%d.%d.%d", last_major, last_minor, last_micro); - g_settings_set_string (client, "last-upgraded-version", string); + g_settings_set_string (settings, "last-upgraded-version", string); g_free (string); g_object_unref (settings); -- cgit v1.2.3 From c75f58d01bb7bbe139cd73a85894dc5f50185816 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 18 Nov 2011 09:58:44 -0500 Subject: Fix compiler warnings. --- shell/e-shell-migrate.c | 1 - 1 file changed, 1 deletion(-) (limited to 'shell/e-shell-migrate.c') diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c index 1931011516..b0fa40d146 100644 --- a/shell/e-shell-migrate.c +++ b/shell/e-shell-migrate.c @@ -901,7 +901,6 @@ e_shell_migrate_attempt (EShell *shell) ESEvent *ese; GSettings *settings; GConfClient *client; - const gchar *key; gint major, minor, micro; gint last_major, last_minor, last_micro; gint curr_major, curr_minor, curr_micro; -- cgit v1.2.3