diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-08-14 04:25:21 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-08-14 04:25:21 +0800 |
commit | abe99cb78c92a0975bb9297f4f53eae1f16efac6 (patch) | |
tree | 2a403e30be0a0129c544e091701e943b236ed326 /shell/main.c | |
parent | 5f73032707d4a5e54647903268d81e630e240238 (diff) | |
download | gsoc2013-evolution-abe99cb78c92a0975bb9297f4f53eae1f16efac6.tar.gz gsoc2013-evolution-abe99cb78c92a0975bb9297f4f53eae1f16efac6.tar.zst gsoc2013-evolution-abe99cb78c92a0975bb9297f4f53eae1f16efac6.zip |
Replaced the chained `if' statements with a `switch' statement for
* main.c (idle_cb): Replaced the chained `if' statements with a
`switch' statement for clarity. Also, don't ref the created
shell, and release the object reference properly.
svn path=/trunk/; revision=11956
Diffstat (limited to 'shell/main.c')
-rw-r--r-- | shell/main.c | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/shell/main.c b/shell/main.c index 5520007a3e..14291562e4 100644 --- a/shell/main.c +++ b/shell/main.c @@ -147,7 +147,26 @@ idle_cb (void *data) shell = e_shell_new (evolution_directory, ! no_splash, &result); g_free (evolution_directory); - if (result == E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER) { + switch (result) { + case E_SHELL_CONSTRUCT_RESULT_OK: + gtk_signal_connect (GTK_OBJECT (shell), "no_views_left", + GTK_SIGNAL_FUNC (no_views_left_cb), NULL); + gtk_signal_connect (GTK_OBJECT (shell), "destroy", + GTK_SIGNAL_FUNC (destroy_cb), NULL); + + if (uri_list == NULL) + restored = e_shell_restore_from_settings (shell); + else + restored = FALSE; + + if (!getenv ("EVOLVE_ME_HARDER")) + development_warning (); + + corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell)); + corba_shell = CORBA_Object_duplicate (corba_shell, &ev); + break; + + case E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER: corba_shell = oaf_activate_from_id (E_SHELL_OAFIID, 0, NULL, &ev); if (ev._major != CORBA_NO_EXCEPTION || corba_shell == CORBA_OBJECT_NIL) { e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, @@ -158,30 +177,16 @@ idle_cb (void *data) } restored = FALSE; - } else if (result != E_SHELL_CONSTRUCT_RESULT_OK) { + break; + + default: e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("Cannot initialize the Evolution shell: %s"), e_shell_construct_result_to_string (result)); CORBA_exception_free (&ev); gtk_main_quit (); return FALSE; - } else { - gtk_signal_connect (GTK_OBJECT (shell), "no_views_left", - GTK_SIGNAL_FUNC (no_views_left_cb), NULL); - gtk_signal_connect (GTK_OBJECT (shell), "destroy", - GTK_SIGNAL_FUNC (destroy_cb), NULL); - - if (uri_list == NULL) - restored = e_shell_restore_from_settings (shell); - else - restored = FALSE; - if (!getenv ("EVOLVE_ME_HARDER")) - development_warning (); - - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell)); - corba_shell = CORBA_Object_duplicate (corba_shell, &ev); - Bonobo_Unknown_ref (corba_shell, &ev); } if (! restored && uri_list == NULL) { @@ -206,8 +211,10 @@ idle_cb (void *data) g_slist_free (uri_list); } - CORBA_exception_free (&ev); + CORBA_Object_release (corba_shell, &ev); + CORBA_exception_free (&ev); + if (shell == NULL) gtk_main_quit (); @@ -231,6 +238,9 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); textdomain (PACKAGE); + /* Make ElectricFence work. */ + free (malloc (10)); + gnome_init_with_popt_table ("Evolution", VERSION, argc, argv, options, 0, &popt_context); if (evolution_debug_log) { |