diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2002-09-05 06:39:30 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2002-09-05 06:39:30 +0800 |
commit | 0857bf4b47e80fd3ac3bf99afa01c2e274244e18 (patch) | |
tree | 2b06e84e5d867856ea29e757ea9ab53608728656 /shell/main.c | |
parent | a6939cf10dffcd41d609bc0131f1e0b882529fbf (diff) | |
download | gsoc2013-evolution-0857bf4b47e80fd3ac3bf99afa01c2e274244e18.tar.gz gsoc2013-evolution-0857bf4b47e80fd3ac3bf99afa01c2e274244e18.tar.zst gsoc2013-evolution-0857bf4b47e80fd3ac3bf99afa01c2e274244e18.zip |
Add a -DPREFIX.
* Makefile.am (INCLUDES): Add a -DPREFIX.
* main.c (main): New command-line option "force-upgrade".
(show_development_warning): Suggest 1.0.8, not 1.0.5.
(upgrade_from_1_0_if_needed): New.
(idle_cb): Call it.
svn path=/trunk/; revision=17982
Diffstat (limited to 'shell/main.c')
-rw-r--r-- | shell/main.c | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/shell/main.c b/shell/main.c index b22fd8fa5e..d876d1c040 100644 --- a/shell/main.c +++ b/shell/main.c @@ -42,6 +42,8 @@ #include <libgnomeui/gnome-stock.h> #include <libgnomeui/gnome-window-icon.h> #include <bonobo/bonobo-main.h> +#include <bonobo/bonobo-moniker-util.h> +#include <bonobo/bonobo-exception.h> #include <glade/glade.h> #include <liboaf/liboaf.h> @@ -69,6 +71,8 @@ static char *evolution_directory = NULL; static gboolean no_splash = FALSE; static gboolean start_online = FALSE; static gboolean start_offline = FALSE; +static gboolean force_upgrade = FALSE; + extern char *evolution_debug_log; @@ -227,7 +231,7 @@ show_development_warning (GtkWindow *parent) "but some features are either unfinished or don't work properly.\n" "\n" "If you want a stable version of Evolution, we urge you to uninstall,\n" - "this version, and install a 1.0.x version instead (1.0.5 recommended).\n" + "this version, and install a 1.0.x version instead (1.0.8)\n" "\n" "If you find bugs, please report them to us at bugzilla.ximian.com.\n" "This product comes with no warranty and is not intended for\n" @@ -295,6 +299,46 @@ new_view_created_callback (EShell *shell, } +static void +upgrade_from_1_0_if_needed (void) +{ + Bonobo_ConfigDatabase config_db; + CORBA_Environment ev; + int result; + + CORBA_exception_init (&ev); + + config_db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); + if (BONOBO_EX (&ev) || config_db == CORBA_OBJECT_NIL) { + g_print ("(Cannot access Bonobo/ConfigDatabase, not upgrading configuration.)\n"); + if (BONOBO_EX (&ev)) + g_print ("\t%s\n", BONOBO_EX_ID (&ev)); + CORBA_exception_free (&ev); + return; + } + + CORBA_exception_free (&ev); + + if (! force_upgrade + && bonobo_config_get_boolean_with_default (config_db, "/Shell/upgrade_from_1_0_to_1_2_performed", + FALSE, NULL)) + return; + + g_print ("\nOlder configuration files detected, upgrading...\n"); + + result = system (PREFIX "/bin/evolution-mail-upgrade"); + + if (result == 0) + g_print ("\n--> Configuration files upgraded from version 1.0.\n"); + else + g_print ("\n*** Error upgrading configuration files -- status %d\n", result); + + bonobo_config_set_boolean (config_db, "/Shell/upgrade_from_1_0_to_1_2_performed", TRUE, NULL); + + bonobo_object_release_unref (config_db, NULL); +} + + /* This is for doing stuff that requires the GTK+ loop to be running already. */ static gint @@ -310,6 +354,8 @@ idle_cb (void *data) gboolean display_default; gboolean displayed_any; + upgrade_from_1_0_if_needed (); + CORBA_exception_init (&ev); uri_list = (GSList *) data; @@ -435,10 +481,16 @@ int main (int argc, char **argv) { struct poptOption options[] = { - { "no-splash", '\0', POPT_ARG_NONE, &no_splash, 0, N_("Disable splash screen"), NULL }, - { "offline", '\0', POPT_ARG_NONE, &start_offline, 0, N_("Start in offline mode"), NULL }, - { "online", '\0', POPT_ARG_NONE, &start_online, 0, N_("Start in online mode"), NULL }, - { "debug", '\0', POPT_ARG_STRING, &evolution_debug_log, 0, N_("Send the debugging output of all components to a file."), NULL }, + { "no-splash", '\0', POPT_ARG_NONE, &no_splash, 0, + N_("Disable splash screen"), NULL }, + { "offline", '\0', POPT_ARG_NONE, &start_offline, 0, + N_("Start in offline mode"), NULL }, + { "online", '\0', POPT_ARG_NONE, &start_online, 0, + N_("Start in online mode"), NULL }, + { "debug", '\0', POPT_ARG_STRING, &evolution_debug_log, 0, + N_("Send the debugging output of all components to a file."), NULL }, + { "force-upgrade", '\0', POPT_ARG_STRING, &force_upgrade, 0, + N_("Force upgrading of configuration files from Evolution 1.0.x"), NULL }, { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &oaf_popt_options, 0, NULL, NULL }, POPT_AUTOHELP { NULL, '\0', 0, NULL, 0, NULL, NULL } |