aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2003-11-18 05:27:21 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2003-11-18 05:27:21 +0800
commitc6b3809b47d4c5166d5244754f28b03ec5d5d60b (patch)
tree8076b2d754096a5196999295790f0099045d9884 /shell
parent9582e8159c9862e160d8b7569c534c8196e40686 (diff)
downloadgsoc2013-evolution-c6b3809b47d4c5166d5244754f28b03ec5d5d60b.tar
gsoc2013-evolution-c6b3809b47d4c5166d5244754f28b03ec5d5d60b.tar.gz
gsoc2013-evolution-c6b3809b47d4c5166d5244754f28b03ec5d5d60b.tar.bz2
gsoc2013-evolution-c6b3809b47d4c5166d5244754f28b03ec5d5d60b.tar.lz
gsoc2013-evolution-c6b3809b47d4c5166d5244754f28b03ec5d5d60b.tar.xz
gsoc2013-evolution-c6b3809b47d4c5166d5244754f28b03ec5d5d60b.tar.zst
gsoc2013-evolution-c6b3809b47d4c5166d5244754f28b03ec5d5d60b.zip
New helper function. (idle_cb): Call it if we have a local shell. Also,
* main.c (attempt_upgrade): New helper function. (idle_cb): Call it if we have a local shell. Also, remove unused variables. * e-shell.c (e_shell_attempt_upgrade): New. * Evolution-Component.idl (Component.upgradeFromeVersion): New. svn path=/trunk/; revision=23403
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog10
-rw-r--r--shell/Evolution-Component.idl8
-rw-r--r--shell/e-shell.c75
-rw-r--r--shell/e-shell.h3
-rw-r--r--shell/main.c24
5 files changed, 117 insertions, 3 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index a7e16e552a..eaa5d2013c 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,15 @@
2003-11-17 Ettore Perazzoli <ettore@ximian.com>
+ * main.c (attempt_upgrade): New helper function.
+ (idle_cb): Call it if we have a local shell. Also, remove unused
+ variables.
+
+ * e-shell.c (e_shell_attempt_upgrade): New.
+
+ * Evolution-Component.idl (Component.upgradeFromeVersion): New.
+
+2003-11-17 Ettore Perazzoli <ettore@ximian.com>
+
* e-shell-window-commands.c (command_open_new_window): New,
implement "OpenNewWindow" verb.
diff --git a/shell/Evolution-Component.idl b/shell/Evolution-Component.idl
index c9c5afaf11..4ccf92431a 100644
--- a/shell/Evolution-Component.idl
+++ b/shell/Evolution-Component.idl
@@ -29,6 +29,14 @@ module Evolution {
exception Failed {};
exception UnknownType {};
+
+ /*** Upgrade path. ***/
+
+ boolean upgradeFromVersion (in short major, in short minor, in short revision);
+
+
+ /*** Basic functionality. ***/
+
/* Create the controls for embedding in the shell. */
void createControls (out Bonobo::Control sidebar_control,
out Bonobo::Control view_control)
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 22cb17e7b4..c6b2f782e3 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-shell.c
*
- * Copyright (C) 2000, 2001, 2002 Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002, 2003 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@@ -584,6 +584,79 @@ e_shell_new (EShellStartupLineMode startup_line_mode,
/**
+ * e_shell_attempt_upgrade:
+ * @shell:
+ * @from_version:
+ *
+ * Upgrade config and components from the specified version name.
+ *
+ * Return value: %TRUE If it works, %FALSE if it fails (it should only fail if
+ * upgrade from @from_version is unsupported).
+ **/
+gboolean
+e_shell_attempt_upgrade (EShell *shell,
+ const char *from_version)
+{
+ GSList *component_infos, *p;
+ int major, minor, revision;
+ int current_major, current_minor, current_revision;
+ gboolean success;
+
+ g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
+ g_return_val_if_fail (from_version != NULL, FALSE);
+
+ sscanf (from_version, "%u.%u.%u", &major, &minor, &revision);
+ sscanf (VERSION, "%u.%u.%u", &current_major, &current_minor, &current_revision);
+
+ if (! (current_major > major
+ || (current_major == major && current_minor > minor)
+ || (current_minor == current_minor && current_revision > current_revision))) {
+ return TRUE;
+ }
+
+ success = TRUE;
+
+ component_infos = e_component_registry_peek_list (shell->priv->component_registry);
+ for (p = component_infos; 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);
+
+ 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 %s failed with exception %s",
+ info->alias, from_version, 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 \"%s\"",
+ info->alias, from_version);
+ success = FALSE;
+ }
+ }
+ }
+
+ return success;
+}
+
+
+/**
* e_shell_create_window:
* @shell: The shell for which to create a new window.
* @component_id: Id or alias of the component to display in the new window.
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 712fda8033..499b31728e 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -100,6 +100,9 @@ EShellConstructResult e_shell_construct (EShell *shell,
EShell *e_shell_new (EShellStartupLineMode startup_line_mode,
EShellConstructResult *construct_result_return);
+gboolean e_shell_attempt_upgrade (EShell *shell,
+ const char *from_version);
+
EShellWindow *e_shell_create_window (EShell *shell,
const char *component_id,
EShellWindow *template_window);
diff --git a/shell/main.c b/shell/main.c
index 6285e55560..d89566a6aa 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -340,6 +340,25 @@ new_window_created_callback (EShell *shell,
#endif /* DEVELOPMENT_WARNING */
+static void
+attempt_upgrade (EShell *shell)
+{
+ GConfClient *gconf_client = gconf_client_get_default ();
+ char *previous_version = gconf_client_get_string (gconf_client, "/apps/evolution/version", NULL);
+
+ if (previous_version != NULL) {
+ if (! e_shell_attempt_upgrade (shell, previous_version))
+ e_notice (NULL, GTK_MESSAGE_ERROR,
+ _("Warning: Evolution could not upgrade all your data from version %s.\n"
+ "The data hasn't been deleted, but it will not be seen by this version of Evolution.\n"),
+ previous_version);
+ }
+
+ gconf_client_set_string (gconf_client, "/apps/evolution/version", VERSION, NULL);
+ g_object_unref (gconf_client);
+}
+
+
/* This is for doing stuff that requires the GTK+ loop to be running already. */
static gint
@@ -352,8 +371,6 @@ idle_cb (void *data)
EShellStartupLineMode startup_line_mode;
GSList *p;
gboolean have_evolution_uri;
- gboolean display_default;
- gboolean displayed_any;
#ifdef KILL_PROCESS_CMD
kill_old_dataserver ();
@@ -408,6 +425,9 @@ idle_cb (void *data)
}
+ if (shell != NULL)
+ attempt_upgrade (shell);
+
have_evolution_uri = FALSE;
if (uri_list == NULL && shell != NULL)