aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-03-03 04:00:01 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-03-30 07:04:00 +0800
commit797acc24457e34c29332d9f1be5bd19e84aab111 (patch)
tree6a7ffd65d824ffab78c50794bfc9b20bdfdd35af /shell
parent3c1c071f490c2b090326b53c29540fff713af380 (diff)
downloadgsoc2013-evolution-797acc24457e34c29332d9f1be5bd19e84aab111.tar.gz
gsoc2013-evolution-797acc24457e34c29332d9f1be5bd19e84aab111.tar.zst
gsoc2013-evolution-797acc24457e34c29332d9f1be5bd19e84aab111.zip
Drop support for migrating from Evolution < 2.0.
There's too much ancient, crufty code there that we can't realistically support anymore. A workaround for those poor users still on 1.x is to upgrade to some 2.x release first, then upgrade again to 3.x. An error dialog explaining this will be shown at startup.
Diffstat (limited to 'shell')
-rw-r--r--shell/Makefile.am4
-rw-r--r--shell/e-config-upgrade.c162
-rw-r--r--shell/e-config-upgrade.h29
-rw-r--r--shell/e-shell-migrate.c194
-rw-r--r--shell/main.c29
-rw-r--r--shell/shell.error.xml40
6 files changed, 35 insertions, 423 deletions
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 0a93912680..103953d906 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -117,9 +117,7 @@ evolution_CPPFLAGS = \
$(SHELL_CFLAGS)
evolution_SOURCES = \
- e-config-upgrade.c \
- e-config-upgrade.h \
- main.c
+ main.c
evolution_LDADD = \
libeshell.la \
diff --git a/shell/e-config-upgrade.c b/shell/e-config-upgrade.c
deleted file mode 100644
index a933972b9b..0000000000
--- a/shell/e-config-upgrade.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * e-upgrade.c - upgrade previous config versions
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- * Jeffery Stedfast <fejj@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include <config.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <ctype.h>
-
-#include <glib.h>
-
-#include <gconf/gconf.h>
-#include <gconf/gconf-client.h>
-
-#include <libedataserver/e-xml-utils.h>
-
-#include "e-util/e-bconf-map.h"
-
-#include "e-config-upgrade.h"
-
-/* ********************************************************************** */
-/* Tables for bonobo conf -> gconf conversion */
-/* ********************************************************************** */
-
-/* ********************************************************************** */
-
-static e_gconf_map_t importer_elm_map[] = {
- /* /Importer/Elm */
- { "mail", "importer/elm/mail", E_GCONF_MAP_BOOL },
- { "mail-imported", "importer/elm/mail-imported", E_GCONF_MAP_BOOL },
- { NULL },
-};
-
-static e_gconf_map_t importer_pine_map[] = {
- /* /Importer/Pine */
- { "mail", "importer/elm/mail", E_GCONF_MAP_BOOL },
- { "address", "importer/elm/address", E_GCONF_MAP_BOOL },
- { NULL },
-};
-
-static e_gconf_map_t importer_netscape_map[] = {
- /* /Importer/Netscape */
- { "mail", "importer/netscape/mail", E_GCONF_MAP_BOOL },
- { "settings", "importer/netscape/settings", E_GCONF_MAP_BOOL },
- { "filters", "importer/netscape/filters", E_GCONF_MAP_BOOL },
- { NULL },
-};
-
-/* ********************************************************************** */
-
-/* This grabs the defaults from the first view ... (?) */
-static e_gconf_map_t shell_views_map[] = {
- /* /Shell/Views/0 */
- { "Width", "shell/view_defaults/width", E_GCONF_MAP_INT },
- { "Height", "shell/view_defaults/height", E_GCONF_MAP_INT },
- { "ViewPanedPosition", "shell/view_defaults/folder_bar/width", E_GCONF_MAP_INT },
- { NULL },
-};
-
-static e_gconf_map_t offlinefolders_map[] = {
- /* /OfflineFolders */
- { "paths", "shell/offline/folder_paths", E_GCONF_MAP_ANYLIST },
- { NULL },
-};
-
-static e_gconf_map_t shell_map[] = {
- /* /Shell */
- { "StartOffline", "shell/start_offline", E_GCONF_MAP_BOOL },
- { NULL },
-};
-
-/* ********************************************************************** */
-
-static e_gconf_map_t addressbook_map[] = {
- /* /Addressbook */
- { "select_names_uri", "addressbook/select_names/last_used_uri", E_GCONF_MAP_STRING },
- { NULL },
-};
-
-static e_gconf_map_t addressbook_completion_map[] = {
- /* /Addressbook/Completion */
- { "uris", "addressbook/completion/uris", E_GCONF_MAP_STRING },
- { NULL },
-};
-
-/* ********************************************************************** */
-
-static e_gconf_map_t general_map[] = {
- /* /General */
- { "CategoryMasterList", "general/category_master_list", E_GCONF_MAP_STRING }
-};
-
-/* ********************************************************************** */
-
-static e_gconf_map_list_t remap_list[] = {
- { "/Importer/Elm", importer_elm_map },
- { "/Importer/Pine", importer_pine_map },
- { "/Importer/Netscape", importer_netscape_map },
-
- { "/Shell", shell_map },
- { "/Shell/Views/0", shell_views_map },
- { "/OfflineFolders", offlinefolders_map },
-
- { "/Addressbook", addressbook_map },
- { "/Addressbook/Completion", addressbook_completion_map },
-
- { "/General", general_map },
-
- { NULL },
-};
-
-gint
-e_config_upgrade(gint major, gint minor, gint revision)
-{
- xmlDocPtr config_doc;
- gchar *conf_file;
- gint res = 0;
-
- conf_file = g_build_filename (g_get_home_dir (), "evolution", "config.xmldb", NULL);
- config_doc = e_xml_parse_file (conf_file);
- g_free (conf_file);
-
- if (config_doc && major <=1 && minor < 3) {
- GConfClient *gconf;
-
- /* move bonobo config to gconf */
- gconf = gconf_client_get_default ();
-
- res = e_bconf_import (gconf, config_doc, remap_list);
- if (res != 0)
- g_warning("Could not move config from bonobo-conf to gconf");
-
- g_object_unref (gconf);
-
- xmlFreeDoc(config_doc);
- }
-
- return res;
-}
diff --git a/shell/e-config-upgrade.h b/shell/e-config-upgrade.h
deleted file mode 100644
index 36901109d7..0000000000
--- a/shell/e-config-upgrade.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_CONFIG_UPGRADE_H
-#define _E_CONFIG_UPGRADE_H
-
-gint e_config_upgrade (gint major, gint minor, gint revision);
-
-#endif /* _E_CONFIG_UPGRADE_H */
diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c
index dd5ad07b24..d26c9a83d1 100644
--- a/shell/e-shell-migrate.c
+++ b/shell/e-shell-migrate.c
@@ -27,7 +27,6 @@
#include <glib/gstdio.h>
#include <libedataserver/e-xml-utils.h>
-#include "e-util/e-bconf-map.h"
#include "e-util/e-alert-dialog.h"
#include "e-util/e-file-utils.h"
#include "e-util/e-util.h"
@@ -37,29 +36,36 @@
#define GCONF_VERSION_KEY "/apps/evolution/version"
#define GCONF_LAST_VERSION_KEY "/apps/evolution/last_version"
-static const gchar *
-shell_migrate_get_old_data_dir (void)
-{
- static gchar *old_data_dir = NULL;
-
- if (G_UNLIKELY (old_data_dir == NULL))
- old_data_dir = g_build_filename (
- g_get_home_dir (), "evolution", NULL);
-
- return old_data_dir;
-}
-
static gboolean
shell_migrate_attempt (EShell *shell,
gint major,
gint minor,
gint micro)
{
+ GtkWindow *parent;
GList *backends;
gboolean success = TRUE;
+ parent = e_shell_get_active_window (shell);
backends = e_shell_get_shell_backends (shell);
+ /* We only support migrating from version 2 now. */
+ if (major < 2) {
+ gchar *version;
+ gint response;
+
+ version = g_strdup_printf ("%d.%d", major, minor);
+ response = e_alert_run_dialog_for_args (
+ parent, "shell:upgrade-version-too-old",
+ version, NULL);
+ g_free (version);
+
+ return (response == GTK_RESPONSE_OK);
+ }
+
+ /* Ask each of the shell backends to migrate their own data.
+ * XXX If something fails the user may end up with only partially
+ * migrated data. Need transaction semantics here, but how? */
while (success && backends != NULL) {
EShellBackend *shell_backend = backends->data;
GError *error = NULL;
@@ -71,11 +77,10 @@ shell_migrate_attempt (EShell *shell,
gint response;
response = e_alert_run_dialog_for_args (
- e_shell_get_active_window (shell), "shell:upgrade-failed",
+ parent, "shell:upgrade-failed",
error->message, NULL);
- if (response == GTK_RESPONSE_CANCEL)
- success = FALSE;
+ success = (response == GTK_RESPONSE_OK);
g_error_free (error);
}
@@ -94,11 +99,8 @@ shell_migrate_get_version (EShell *shell,
{
GConfClient *client;
const gchar *key;
- const gchar *old_data_dir;
gchar *string;
- old_data_dir = shell_migrate_get_old_data_dir ();
-
key = GCONF_VERSION_KEY;
client = e_shell_get_gconf_client (shell);
string = gconf_client_get_string (client, key, NULL);
@@ -108,90 +110,12 @@ shell_migrate_get_version (EShell *shell,
sscanf (string, "%d.%d.%d", major, minor, micro);
g_free (string);
- } else if (!g_file_test (old_data_dir, G_FILE_TEST_IS_DIR)) {
- /* If the old data directory does not exist,
- * it must be a new installation. */
+ } else {
+ /* Otherwise, assume it's a new installation. */
*major = 0;
*minor = 0;
*micro = 0;
-
- } else {
- xmlDocPtr doc;
- xmlNodePtr source;
- gchar *filename;
-
- filename = g_build_filename (
- old_data_dir, "config.xmldb", NULL);
- doc = e_xml_parse_file (filename);
- g_free (filename);
-
- if (doc == NULL)
- return;
-
- source = e_bconf_get_path (doc, "/Shell");
- if (source != NULL) {
- key = "upgrade_from_1_0_to_1_2_performed";
- string = e_bconf_get_value (source, key);
- }
-
- if (string != NULL && *string == '1') {
- *major = 1;
- *minor = 2;
- *micro = 0;
- } else {
- *major = 1;
- *minor = 0;
- *micro = 0;
- }
-
- g_free (string);
-
- if (doc != NULL)
- xmlFreeDoc (doc);
- }
-}
-
-static gint
-shell_migrate_remove_dir (const gchar *root,
- const gchar *path)
-{
- GDir *dir;
- const gchar *basename;
- gchar *filename = NULL;
- gint result = -1;
-
- /* Recursively removes a directory and its contents. */
-
- dir = g_dir_open (path, 0, NULL);
- if (dir == NULL)
- return -1;
-
- while ((basename = g_dir_read_name (dir)) != NULL) {
- filename = g_build_filename (path, basename, NULL);
-
- /* Make sure we haven't strayed from the evolution dir. */
- g_return_val_if_fail (strlen (path) >= strlen (root), -1);
- g_return_val_if_fail (g_str_has_prefix (path, root), -1);
-
- if (g_file_test (filename, G_FILE_TEST_IS_DIR)) {
- if (shell_migrate_remove_dir (root, filename) < 0)
- goto fail;
- } else {
- if (g_unlink (filename) < 0)
- goto fail;
- }
-
- g_free (filename);
- filename = NULL;
}
-
- result = g_rmdir (path);
-
-fail:
- g_free (filename);
- g_dir_close (dir);
-
- return result;
}
static void
@@ -241,7 +165,6 @@ e_shell_migrate_attempt (EShell *shell)
ESEvent *ese;
GConfClient *client;
const gchar *key;
- const gchar *old_data_dir;
gint major, minor, micro;
gint last_major, last_minor, last_micro;
gint curr_major, curr_minor, curr_micro;
@@ -251,7 +174,6 @@ e_shell_migrate_attempt (EShell *shell)
g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
client = e_shell_get_gconf_client (shell);
- old_data_dir = shell_migrate_get_old_data_dir ();
if (sscanf (BASE_VERSION, "%d.%d", &curr_major, &curr_minor) != 2) {
g_warning ("Could not parse BASE_VERSION (%s)", BASE_VERSION);
@@ -271,38 +193,12 @@ e_shell_migrate_attempt (EShell *shell)
(curr_major == major && curr_minor == minor && curr_micro > micro)))
goto check_old;
- /* If upgrading from < 1.5, we need to copy most data from
- * ~/evolution to ~/.evolution. Make sure we have the disk
- * space for it before proceeding. */
- if (major == 1 && minor < 5) {
- glong avail;
- glong usage;
-
- usage = e_fsutils_usage (old_data_dir);
- avail = e_fsutils_avail (g_get_home_dir ());
- if (usage >= 0 && avail >= 0 && avail < usage) {
- gchar *need;
- gchar *have;
-
- need = g_strdup_printf (_("%ld KB"), usage);
- have = g_strdup_printf (_("%ld KB"), avail);
-
- e_alert_run_dialog_for_args (
- e_shell_get_active_window (shell), "shell:upgrade-nospace",
- need, have, NULL);
-
- g_free (need);
- g_free (have);
-
- _exit (EXIT_SUCCESS);
- }
- }
-
if (!shell_migrate_attempt (shell, major, minor, micro))
_exit (EXIT_SUCCESS);
/* Record a successful migration. */
- string = g_strdup_printf ("%d.%d.%d", curr_major, curr_minor, curr_micro);
+ string = g_strdup_printf (
+ "%d.%d.%d", curr_major, curr_minor, curr_micro);
gconf_client_set_string (client, GCONF_VERSION_KEY, string, NULL);
g_free (string);
@@ -322,46 +218,6 @@ check_old:
}
g_free (string);
- /* If the last migrated version was old, check for stuff to remove. */
- if (last_major == 1 && last_minor < 5 &&
- g_file_test (old_data_dir, G_FILE_TEST_IS_DIR)) {
-
- gint response;
-
- string = g_strdup_printf (
- "%d.%d.%d", last_major, last_minor, last_micro);
- response = e_alert_run_dialog_for_args (
- e_shell_get_active_window (shell), "shell:upgrade-remove-1-4", string, NULL);
- g_free (string);
-
- switch (response) {
- case GTK_RESPONSE_OK: /* delete */
- response = e_alert_run_dialog_for_args (
- e_shell_get_active_window (shell),
- "shell:upgrade-remove-1-4-confirm",
- NULL);
- if (response == GTK_RESPONSE_OK)
- shell_migrate_remove_dir (
- old_data_dir, old_data_dir);
- else
- break;
- /* fall through */
-
- case GTK_RESPONSE_ACCEPT: /* keep */
- last_major = curr_major;
- last_minor = curr_minor;
- last_micro = curr_micro;
- break;
-
- default:
- break;
- }
- } else {
- last_major = curr_major;
- last_minor = curr_minor;
- last_micro = curr_micro;
- }
-
string = g_strdup_printf (
"%d.%d.%d", last_major, last_minor, last_micro);
gconf_client_set_string (client, key, string, NULL);
diff --git a/shell/main.c b/shell/main.c
index e3d69412a6..469df2df11 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -49,10 +49,8 @@
#include "e-shell.h"
#include "e-shell-migrate.h"
-#include "e-config-upgrade.h"
#include "es-event.h"
-#include "e-util/e-bconf-map.h"
#include "e-util/e-dialog-utils.h"
#include "e-util/e-import.h"
#include "e-util/e-plugin.h"
@@ -82,9 +80,6 @@ static gboolean start_online = FALSE;
static gboolean start_offline = FALSE;
static gboolean setup_only = FALSE;
static gboolean force_shutdown = FALSE;
-#ifdef DEVELOPMENT
-static gboolean force_migrate = FALSE;
-#endif
static gboolean disable_eplugin = FALSE;
static gboolean disable_preview = FALSE;
static gboolean import_uris = FALSE;
@@ -214,21 +209,6 @@ show_development_warning(void)
return skip;
}
-static void
-destroy_config (GConfClient *client)
-{
- /* Unset the source stuff */
- gconf_client_unset (client, "/apps/evolution/calendar/sources", NULL);
- gconf_client_unset (client, "/apps/evolution/tasks/sources", NULL);
- gconf_client_unset (client, "/apps/evolution/addressbook/sources", NULL);
-
- /* Reset the version */
- gconf_client_set_string (client, "/apps/evolution/version", "1.4.0", NULL);
-
- /* Clear the dir */
- system ("rm -Rf ~/.evolution");
-}
-
#endif /* DEVELOPMENT */
/* This is for doing stuff that requires the GTK+ loop to be running already. */
@@ -332,10 +312,6 @@ static GOptionEntry entries[] = {
{ "force-shutdown", '\0', 0, G_OPTION_ARG_NONE, &force_shutdown,
N_("Forcibly shut down Evolution"), NULL },
#endif
-#ifdef DEVELOPMENT
- { "force-migrate", '\0', 0, G_OPTION_ARG_NONE, &force_migrate,
- N_("Forcibly re-migrate from Evolution 1.4"), NULL },
-#endif
{ "debug", '\0', 0, G_OPTION_ARG_STRING, &evolution_debug_log,
N_("Send the debugging output of all components to a file."), "FILE" },
{ "disable-eplugin", '\0', 0, G_OPTION_ARG_NONE, &disable_eplugin,
@@ -499,11 +475,6 @@ main (gint argc, gchar **argv)
client = gconf_client_get_default ();
-#ifdef DEVELOPMENT
- if (force_migrate)
- destroy_config (client);
-#endif
-
if (disable_preview) {
const gchar *key;
diff --git a/shell/shell.error.xml b/shell/shell.error.xml
index 3f3f0e2f86..6c75baa9df 100644
--- a/shell/shell.error.xml
+++ b/shell/shell.error.xml
@@ -7,45 +7,23 @@
<button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
</error>
- <error id="upgrade-nospace" type="error">
- <_primary>Insufficient disk space for upgrade.</_primary>
- <_secondary xml:space="preserve">Upgrading your data and settings will require up to {0} of disk space, but you only have {1} available.
-
-You will need to make more space available in your home directory before you can continue.</_secondary>
- <button stock="gtk-quit" response="GTK_RESPONSE_CANCEL"/>
- </error>
-
<error id="upgrade-failed" type="error">
<_primary>Upgrade from previous version failed:</_primary>
<_secondary xml:space="preserve">{0}
If you choose to continue, you may not have access to some of your old data.
</_secondary>
- <button stock="gtk-quit" response="GTK_RESPONSE_CANCEL"/>
- <button stock="gtk-ok" _label="Continue" response="GTK_RESPONSE_OK"/>
+ <button _label="Continue Anyway" response="GTK_RESPONSE_OK"/>
+ <button _label="Quit Now" response="GTK_RESPONSE_CANCEL"/>
</error>
- <error id="upgrade-remove-1-4" type="question" default="GTK_RESPONSE_CANCEL">
- <_primary>Delete old data from version {0}?</_primary>
- <_secondary xml:space="preserve">The previous version of Evolution stored its data in a different location.
-
-If you choose to remove this data, the entire contents of the &quot;evolution&quot; directory will be removed permanently. If you choose to keep this data, then you may manually remove the contents of &quot;evolution&quot; at your convenience.
-</_secondary>
- <button _label="_Remind Me Later" response="GTK_RESPONSE_CANCEL"/>
- <button _label="_Keep Data" response="GTK_RESPONSE_ACCEPT"/>
- <button stock="gtk-delete" response="GTK_RESPONSE_OK"/>
- </error>
-
- <error id="upgrade-remove-1-4-confirm" type="warning" default="GTK_RESPONSE_CANCEL">
- <_primary>Really delete old data?</_primary>
- <_secondary xml:space="preserve">The entire contents of the &quot;evolution&quot; directory are about to be permanently removed.
-
-It is suggested you manually verify that all of your mail, contact, and calendar data is present, and that this version of Evolution operates correctly before deleting this old data.
-
-Once deleted, you cannot downgrade to the previous version of Evolution without manual intervention.
-</_secondary>
- <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
- <button stock="gtk-delete" response="GTK_RESPONSE_OK"/>
+ <error id="upgrade-version-too-old" type="warning" default="GTK_RESPONSE_CANCEL">
+ <_primary>Cannot upgrade directly from version {0}</_primary>
+ <_secondary>Evolution no longer supports upgrading directly from
+ version {0}. However as a workaround you might try first upgrading
+ to Evolution 2, and then upgrading to Evolution 3.</_secondary>
+ <button _label="Continue Anyway" response="GTK_RESPONSE_OK"/>
+ <button _label="Quit Now" response="GTK_RESPONSE_CANCEL"/>
</error>
<error id="forget-passwords" type="question" default="GTK_RESPONSE_CANCEL">