aboutsummaryrefslogtreecommitdiffstats
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
parentc31e31f1fd019ac4297d840761026e64ea6a0adf (diff)
downloadgsoc2013-evolution-2cf63ca4bace1165d5f0385f4d0dbcce83269775.tar.gz
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
-rw-r--r--shell/ChangeLog31
-rw-r--r--shell/Evolution-Component.idl11
-rw-r--r--shell/Makefile.am9
-rw-r--r--shell/e-shell.c84
-rw-r--r--shell/shell-errors.xml23
-rw-r--r--shell/shell-errors.xml.h14
-rw-r--r--shell/shell-errors.xml.in23
7 files changed, 160 insertions, 35 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index d59e3bfc37..f2d4b454fb 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,34 @@
+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.
+
+2004-05-10 Not Zed <NotZed@Ximian.com>
+
+ * e-shell.c (e_shell_attempt_upgrade): handle the various
+ exceptions appropritately.
+ (detect_version): this never fails, remove return code.
+ (attempt_upgrade): add a check for disk space. this is only
+ rough. not sure how portable. If we can't find out we go forward
+ anyway.
+
+ * Evolution-Component.idl: Throw some proper exceptions for
+ upgradeFromVersion. UpgradeFailed with detailed error reason, and
+ UnsupportedVersion for non-fatal reason.
+
2004-05-10 David Malcolm <dmalcolm@redhat.com>
* e-shell-offline-handler.c (cancel_offline): Fix warning
diff --git a/shell/Evolution-Component.idl b/shell/Evolution-Component.idl
index 69893387fc..f200680633 100644
--- a/shell/Evolution-Component.idl
+++ b/shell/Evolution-Component.idl
@@ -33,11 +33,18 @@ module Evolution {
interface Component : Bonobo::Unknown {
exception Failed {};
exception UnknownType {};
+ /* We don't know about the old version we're upgrading from */
+ exception UnsupportedVersion {};
+ /* We encountered a non-recoverable, fatal error, explain why */
+ exception UpgradeFailed {
+ string what;
+ string why;
+ };
/*** Upgrade path. ***/
- boolean upgradeFromVersion (in short major, in short minor, in short revision);
-
+ void upgradeFromVersion (in short major, in short minor, in short revision)
+ raises (UnsupportedVersion, UpgradeFailed);
/*** Basic functionality. ***/
diff --git a/shell/Makefile.am b/shell/Makefile.am
index e8a459b4d5..4a4715a20e 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -198,6 +198,12 @@ server_DATA = $(server_in_files:.server.in.in=_$(BASE_VERSION).server)
@EVO_SERVER_RULE@
@INTLTOOL_SERVER_RULE@
+error_DATA = shell-errors.xml
+error_i18n = $(error_DATA:.xml=.xml.h)
+errordir = $(privdatadir)/errors
+%.xml.h: %.xml
+ $(top_builddir)/e-util/e-error-tool $^
+
etspec_DATA = e-storage-set-view.etspec
icons = \
@@ -252,6 +258,7 @@ EXTRA_DIST = \
$(IDLS) \
$(server_in_files) \
GNOME_Evolution_Test.server.in.in \
+ $(error_DATA) $(error_i18n) \
$(etspec_DATA) \
$(schema_DATA) \
$(icons) \
@@ -273,7 +280,7 @@ evolution.pure: evolution
endif
-BUILT_SOURCES = $(IDL_GENERATED) $(SELECT_NAMES_IDL_GENERATED) $(MARSHAL_GENERATED) $(server_DATA) $(testserver_DATA) $(DATASERVER_IDL_GENERATED)
+BUILT_SOURCES = $(IDL_GENERATED) $(SELECT_NAMES_IDL_GENERATED) $(MARSHAL_GENERATED) $(server_DATA) $(testserver_DATA) $(DATASERVER_IDL_GENERATED) $(error_i18n)
CLEANFILES = $(BUILT_SOURCES)
dist-hook:
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;
diff --git a/shell/shell-errors.xml b/shell/shell-errors.xml
new file mode 100644
index 0000000000..8d448214b9
--- /dev/null
+++ b/shell/shell-errors.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<error-list domain="shell">
+
+ <error id="upgrade-nospace" type="error">
+ <primary>Insufficient disk space for upgrade.</primary>
+ <secondary>Upgrading your data and settings will require upto {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:
+{0}</primary>
+ <secondary>{1}
+
+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"/>
+ </error>
+
+</error-list>
diff --git a/shell/shell-errors.xml.h b/shell/shell-errors.xml.h
new file mode 100644
index 0000000000..483b6a2050
--- /dev/null
+++ b/shell/shell-errors.xml.h
@@ -0,0 +1,14 @@
+/* shell:upgrade-nospace primary */
+char *s = N_("Insufficient disk space for upgrade.");
+/* shell:upgrade-nospace secondary */
+char *s = N_("Upgrading your data and settings will require upto {0} of disk space, but you only have {1} available.\n"
+ "\n"
+ "You will need to make more space available in your home directory before you can continue.");
+/* shell:upgrade-failed primary */
+char *s = N_("Upgrade from previous version failed:\n"
+ "{0}");
+/* shell:upgrade-failed secondary */
+char *s = N_("{1}\n"
+ "\n"
+ "If you choose to continue, you may not have access to some of your old data.\n"
+ "");
diff --git a/shell/shell-errors.xml.in b/shell/shell-errors.xml.in
new file mode 100644
index 0000000000..70facf2994
--- /dev/null
+++ b/shell/shell-errors.xml.in
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<error-list domain="shell">
+
+ <error id="upgrade-nospace" type="error">
+ <_primary>Insufficient disk space for upgrade.</_primary>
+ <_secondary>Upgrading your data and settings will require upto {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:
+{0}</_primary>
+ <_secondary>{1}
+
+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"/>
+ </error>
+
+</error-list>