aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-05-12 11:33:51 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-05-12 11:33:51 +0800
commit2cf63ca4bace1165d5f0385f4d0dbcce83269775 (patch)
tree3c68cb544d8d2bc4f813324ed65a12db349cbcb3 /shell/e-shell.c
parentc31e31f1fd019ac4297d840761026e64ea6a0adf (diff)
downloadgsoc2013-evolution-2cf63ca4bace1165d5f0385f4d0dbcce83269775.tar
gsoc2013-evolution-2cf63ca4bace1165d5f0385f4d0dbcce83269775.tar.gz
gsoc2013-evolution-2cf63ca4bace1165d5f0385f4d0dbcce83269775.tar.bz2
gsoc2013-evolution-2cf63ca4bace1165d5f0385f4d0dbcce83269775.tar.lz
gsoc2013-evolution-2cf63ca4bace1165d5f0385f4d0dbcce83269775.tar.xz
gsoc2013-evolution-2cf63ca4bace1165d5f0385f4d0dbcce83269775.tar.zst
gsoc2013-evolution-2cf63ca4bace1165d5f0385f4d0dbcce83269775.zip
add for translators.
2004-05-12 Not Zed <NotZed@Ximian.com> * shell-errors.xml.h: add for translators. 2004-05-11 Not Zed <NotZed@Ximian.com> * shell-errors.xml: Shell errors. * e-shell.c (e_shell_attempt_upgrade): handle exceptions better. allow the user to keep going or abort. stop as soon as something fails. Related to #53083. (attempt_upgrade): abort and quit if the subcall failed. it will display an appropriate error box. (attempt_upgrade): abort if we don't have enough space. #57290. * Evolution-Component.idl (upgradeFromVersion): remove the return code, use exceptions to indicate failure. svn path=/trunk/; revision=25869
Diffstat (limited to 'shell/e-shell.c')
-rw-r--r--shell/e-shell.c84
1 files changed, 52 insertions, 32 deletions
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 5c69e49e90..0f62ae42d6 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -28,6 +28,8 @@
#include "e-util/e-dialog-utils.h"
#include "e-util/e-bconf-map.h"
+#include "e-util/e-fsutils.h"
+#include "widgets/misc/e-error.h"
#include "e-shell-constants.h"
#include "e-shell-offline-handler.h"
@@ -468,7 +470,7 @@ e_shell_init (EShell *shell)
shell->priv = priv;
}
-static gboolean
+static void
detect_version (GConfClient *gconf, int *major, int *minor, int *revision)
{
char *val, *evolution_dir;
@@ -517,8 +519,6 @@ detect_version (GConfClient *gconf, int *major, int *minor, int *revision)
}
g_free (evolution_dir);
-
- return TRUE;
}
static void
@@ -530,12 +530,30 @@ attempt_upgrade (EShell *shell)
gconf_client = gconf_client_get_default ();
- if (!detect_version (gconf_client, &major, &minor, &revision)
- || !e_shell_attempt_upgrade (shell, major, minor, revision))
- e_notice (NULL, GTK_MESSAGE_ERROR,
- _("Warning: Evolution could not upgrade all your data from version %d.%d.%d.\n"
- "The data hasn't been deleted, but it will not be seen by this version of Evolution.\n"),
- major, minor, revision);
+ detect_version (gconf_client, &major, &minor, &revision);
+
+ /* if upgrading from < 1.5, we need to copy most data from ~/evolution to ~/.evolution */
+ if (major == 1 && minor < 5) {
+ char *path;
+ long size, space;
+
+ path = g_build_filename(g_get_home_dir(), "evolution", NULL);
+ size = e_fsutils_usage(path);
+ g_free(path);
+ space = e_fsutils_avail(g_get_home_dir());
+ if (size != -1 && space != -1 && space < size) {
+ char *required = g_strdup_printf(_("%ld KB"), size);
+ char *have = g_strdup_printf(_("%ld KB"), space);
+
+ e_error_run(NULL, "shell:upgrade-nospace", required, have, NULL);
+ g_free(required);
+ g_free(have);
+ _exit(0);
+ }
+ }
+
+ if (!e_shell_attempt_upgrade (shell, major, minor, revision))
+ _exit(0);
version_string = g_strdup_printf ("%s.%s", BASE_VERSION, UPGRADE_REVISION);
gconf_client_set_string (gconf_client, "/apps/evolution/version", version_string, NULL);
@@ -662,7 +680,6 @@ e_shell_new (EShellStartupLineMode startup_line_mode,
return new;
}
-
/**
* e_shell_attempt_upgrade:
* @shell:
@@ -679,6 +696,7 @@ e_shell_attempt_upgrade (EShell *shell, int major, int minor, int revision)
GSList *component_infos, *p;
int current_major, current_minor, current_revision;
gboolean success;
+ int res;
g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
@@ -695,39 +713,41 @@ e_shell_attempt_upgrade (EShell *shell, int major, int minor, int revision)
success = TRUE;
component_infos = e_component_registry_peek_list (shell->priv->component_registry);
- for (p = component_infos; p != NULL; p = p->next) {
+ for (p = component_infos; success && p != NULL; p = p->next) {
const EComponentInfo *info = p->data;
CORBA_Environment ev;
gboolean component_upgraded;
CORBA_exception_init (&ev);
- component_upgraded = GNOME_Evolution_Component_upgradeFromVersion (info->iface, major, minor, revision, &ev);
+ GNOME_Evolution_Component_upgradeFromVersion (info->iface, major, minor, revision, &ev);
if (BONOBO_EX (&ev)) {
char *exception_text;
-
- /* Ignore components that do not implement this version, it might just mean that they don't need an
- upgrade path. */
- if (strcmp (ev._id, ex_CORBA_NO_IMPLEMENT) == 0) {
- CORBA_exception_free (&ev);
- continue;
- }
-
- exception_text = bonobo_exception_get_text (&ev);
- g_warning ("Upgrade of component \"%s\" from version %d.%d.%d failed with exception %s",
- info->alias, major, minor, revision, exception_text);
- g_free (exception_text);
- CORBA_exception_free (&ev);
- success = FALSE;
- } else {
- CORBA_exception_free (&ev);
- if (! component_upgraded) {
- g_warning ("Component \"%s\" could not upgrade configuration from version %d.%d.%d",
- info->alias, major, minor, revision);
- success = FALSE;
+ CORBA_char *id = CORBA_exception_id(&ev);
+
+ if (strcmp (id, ex_CORBA_NO_IMPLEMENT) == 0) {
+ /* Ignore components that do not implement this version, it
+ might just mean that they don't need an upgrade path. */
+ } else if (strcmp (id, ex_GNOME_Evolution_Component_UpgradeFailed) == 0) {
+ GNOME_Evolution_Component_UpgradeFailed *ex = CORBA_exception_value(&ev);
+
+ res = e_error_run(NULL, "shell:upgrade-failed", ex->what, ex->why, NULL);
+ if (res == GTK_RESPONSE_CANCEL)
+ success = FALSE;
+ } else if (strcmp (id, ex_GNOME_Evolution_Component_UnsupportedVersion) == 0) {
+ /* This is non-fatal */
+ /* DO WE CARE??? */
+ printf("Upgrade of component failed, unsupported prior version\n");
+ } else {
+ exception_text = bonobo_exception_get_text (&ev);
+ res = e_error_run(NULL, "shell:upgrade-failed", exception_text, _("Uknown system error."), NULL);
+ g_free (exception_text);
+ if (res == GTK_RESPONSE_CANCEL)
+ success = FALSE;
}
}
+ CORBA_exception_free (&ev);
}
return success;