diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-08-03 22:27:44 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-08-03 22:27:44 +0800 |
commit | 0039ef5422e980484c47d2fe97c3edbf63edd5b8 (patch) | |
tree | bdc0ba031ab17a176fe758f43c7a12f508fdced5 /shell | |
parent | b5c3ca3079407391e099eea277f37ad45e5866d7 (diff) | |
download | gsoc2013-evolution-0039ef5422e980484c47d2fe97c3edbf63edd5b8.tar gsoc2013-evolution-0039ef5422e980484c47d2fe97c3edbf63edd5b8.tar.gz gsoc2013-evolution-0039ef5422e980484c47d2fe97c3edbf63edd5b8.tar.bz2 gsoc2013-evolution-0039ef5422e980484c47d2fe97c3edbf63edd5b8.tar.lz gsoc2013-evolution-0039ef5422e980484c47d2fe97c3edbf63edd5b8.tar.xz gsoc2013-evolution-0039ef5422e980484c47d2fe97c3edbf63edd5b8.tar.zst gsoc2013-evolution-0039ef5422e980484c47d2fe97c3edbf63edd5b8.zip |
[Fix #6232, the thirty-four-splash-screens-at-startup bug.]
* e-shell.c (setup_local_storage): Add an E_STORAGE() cast to
prevent a warning.
* main.c (idle_cb): Only try to activate from the shell ID if the
result is `E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER'; if there is a
different error, spit out a dialog box with a description of it
and exit instead.
* e-shell.c (e_shell_construct): Return an `EShellConstructResult'
describing what kind of result we had. Show the splash after the
DB has been reached, not before.
(e_shell_construct_result_to_string): New function to get a
descriptive string out of an `EShellConstructResult'.
(e_shell_new): New arg @construct_result_return to return a
description of the result of the operation.
* e-shell.h: New enum `EShellConstructResult'.
* e-shell.c (impl_Shell_createNewView): Raise `InternalError'
instead of crashing if the shell_view returns a CORBA_OBJECT_NIL.
* Evolution-Shell.idl: New exception `InternalError'.
`createNewView' and `handleURI' can raise it.
svn path=/trunk/; revision=11611
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 28 | ||||
-rw-r--r-- | shell/Evolution-Shell.idl | 5 | ||||
-rw-r--r-- | shell/e-shell.c | 81 | ||||
-rw-r--r-- | shell/e-shell.h | 28 | ||||
-rw-r--r-- | shell/main.c | 14 |
5 files changed, 119 insertions, 37 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 1921bd4695..ab2b66a07f 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,5 +1,33 @@ 2001-08-03 Ettore Perazzoli <ettore@ximian.com> + [Fix #6232, the thirty-four-splash-screens-at-startup bug.] + + * e-shell.c (setup_local_storage): Add an E_STORAGE() cast to + prevent a warning. + + * main.c (idle_cb): Only try to activate from the shell ID if the + result is `E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER'; if there is a + different error, spit out a dialog box with a description of it + and exit instead. + + * e-shell.c (e_shell_construct): Return an `EShellConstructResult' + describing what kind of result we had. Show the splash after the + DB has been reached, not before. + (e_shell_construct_result_to_string): New function to get a + descriptive string out of an `EShellConstructResult'. + (e_shell_new): New arg @construct_result_return to return a + description of the result of the operation. + + * e-shell.h: New enum `EShellConstructResult'. + + * e-shell.c (impl_Shell_createNewView): Raise `InternalError' + instead of crashing if the shell_view returns a CORBA_OBJECT_NIL. + + * Evolution-Shell.idl: New exception `InternalError'. + `createNewView' and `handleURI' can raise it. + +2001-08-03 Ettore Perazzoli <ettore@ximian.com> + * e-storage-set-view.c (storage_sort_callback): Put the storage named E_SUMMARY_STORAGE_NAME on top. diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl index 0426c037b0..b99f49abab 100644 --- a/shell/Evolution-Shell.idl +++ b/shell/Evolution-Shell.idl @@ -20,6 +20,7 @@ module Evolution { exception NotFound {}; exception UnsupportedSchema {}; exception InvalidURI {}; + exception InternalError {}; exception Busy {}; typedef sequence<string> FolderTypeNameList; @@ -43,7 +44,7 @@ module Evolution { * Return value: the new view. */ ShellView createNewView (in string uri) - raises (NotFound, UnsupportedSchema, InvalidURI); + raises (NotFound, UnsupportedSchema, InvalidURI, InternalError); /** * handleURI: @@ -55,7 +56,7 @@ module Evolution { * the message composer.) */ void handleURI (in string uri) - raises (NotFound, UnsupportedSchema, InvalidURI); + raises (NotFound, UnsupportedSchema, InvalidURI, InternalError); /** * selectUserFolder: diff --git a/shell/e-shell.c b/shell/e-shell.c index 94db128307..c2aef7d71e 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -243,6 +243,11 @@ impl_Shell_createNewView (PortableServer_Servant servant, } shell_view_interface = e_shell_view_get_corba_interface (shell_view); + if (shell_view_interface == CORBA_OBJECT_NIL) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_GNOME_Evolution_Shell_InternalError, NULL); + return CORBA_OBJECT_NIL; + } Bonobo_Unknown_ref (shell_view_interface, ev); return CORBA_Object_duplicate ((CORBA_Object) shell_view_interface, ev); @@ -455,7 +460,7 @@ setup_local_storage (EShell *shell) priv->local_storage = E_LOCAL_STORAGE (local_storage); priv->summary_storage = E_SUMMARY_STORAGE (e_summary_storage_new ()); - e_storage_set_add_storage (priv->storage_set, priv->summary_storage); + e_storage_set_add_storage (priv->storage_set, E_STORAGE (priv->summary_storage)); return TRUE; } @@ -685,7 +690,6 @@ destroy (GtkObject *object) if (shell->priv->db != CORBA_OBJECT_NIL) bonobo_object_release_unref (shell->priv->db, NULL); - shell->priv->db = CORBA_OBJECT_NIL; /* No unreffing for these as they are aggregate. */ /* bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry)); */ @@ -783,9 +787,9 @@ init (EShell *shell) * Construct @shell so that it uses the specified @local_directory and * @corba_object. * - * Return value: %FALSE if the shell cannot be registered; %TRUE otherwise. + * Return value: The result of the operation. **/ -gboolean +EShellConstructResult e_shell_construct (EShell *shell, const char *iid, const char *local_directory, @@ -797,20 +801,10 @@ e_shell_construct (EShell *shell, CORBA_Environment ev; gchar *shortcut_path; - g_return_val_if_fail (shell != NULL, FALSE); - g_return_val_if_fail (E_IS_SHELL (shell), FALSE); - g_return_val_if_fail (local_directory != NULL, FALSE); - g_return_val_if_fail (g_path_is_absolute (local_directory), FALSE); - - if (! show_splash) { - splash = NULL; - } else { - splash = e_splash_new (); - gtk_widget_show (splash); - } - - while (gtk_events_pending ()) - gtk_main_iteration (); + g_return_val_if_fail (shell != NULL, E_SHELL_CONSTRUCT_RESULT_INVALIDARG); + g_return_val_if_fail (E_IS_SHELL (shell), E_SHELL_CONSTRUCT_RESULT_INVALIDARG); + g_return_val_if_fail (local_directory != NULL, E_SHELL_CONSTRUCT_RESULT_INVALIDARG); + g_return_val_if_fail (g_path_is_absolute (local_directory), E_SHELL_CONSTRUCT_RESULT_INVALIDARG); priv = shell->priv; @@ -828,7 +822,6 @@ e_shell_construct (EShell *shell, CORBA_exception_init (&ev); priv->db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - if (BONOBO_EX (&ev) || priv->db == CORBA_OBJECT_NIL) { g_warning ("Cannot access Bonobo/ConfigDatabase on wombat:"); @@ -838,7 +831,7 @@ e_shell_construct (EShell *shell, priv->db = CORBA_OBJECT_NIL; CORBA_exception_free (&ev); - return FALSE; + return E_SHELL_CONSTRUCT_RESULT_NOCONFIGDB; } CORBA_exception_free (&ev); @@ -851,9 +844,19 @@ e_shell_construct (EShell *shell, corba_object = bonobo_object_corba_objref (BONOBO_OBJECT (shell)); if (oaf_active_server_register (iid, corba_object) != OAF_REG_SUCCESS) { CORBA_exception_free (&ev); - return FALSE; + return E_SHELL_CONSTRUCT_RESULT_GENERICERROR; } + if (! show_splash) { + splash = NULL; + } else { + splash = e_splash_new (); + gtk_widget_show (splash); + } + + while (gtk_events_pending ()) + gtk_main_iteration (); + if (show_splash) setup_components (shell, E_SPLASH (splash)); else @@ -888,13 +891,15 @@ e_shell_construct (EShell *shell, if (show_splash) gtk_widget_destroy (splash); - return TRUE; + return E_SHELL_CONSTRUCT_RESULT_OK; } /** * e_shell_new: * @local_directory: Local directory for storing local information and folders. * @show_splash: Whether to display a splash screen. + * @construct_result_return: A pointer to an EShellConstructResult variable into + * which the result of the operation will be stored. * * Create a new EShell. * @@ -902,17 +907,22 @@ e_shell_construct (EShell *shell, **/ EShell * e_shell_new (const char *local_directory, - gboolean show_splash) + gboolean show_splash, + EShellConstructResult *construct_result_return) { EShell *new; EShellPrivate *priv; + EShellConstructResult construct_result; g_return_val_if_fail (local_directory != NULL, NULL); g_return_val_if_fail (*local_directory != '\0', NULL); new = gtk_type_new (e_shell_get_type ()); - if (! e_shell_construct (new, E_SHELL_OAFIID, local_directory, show_splash)) { + construct_result = e_shell_construct (new, E_SHELL_OAFIID, local_directory, show_splash); + + if (construct_result != E_SHELL_CONSTRUCT_RESULT_OK) { + *construct_result_return = construct_result; bonobo_object_unref (BONOBO_OBJECT (new)); return NULL; } @@ -920,10 +930,13 @@ e_shell_new (const char *local_directory, priv = new->priv; if (priv->shortcuts == NULL || priv->storage_set == NULL) { + /* FIXME? */ + *construct_result_return = E_SHELL_CONSTRUCT_RESULT_GENERICERROR; bonobo_object_unref (BONOBO_OBJECT (new)); return NULL; } + *construct_result_return = E_SHELL_CONSTRUCT_RESULT_OK; return new; } @@ -1501,6 +1514,26 @@ e_shell_unregister_all (EShell *shell) } +const char * +e_shell_construct_result_to_string (EShellConstructResult result) +{ + switch (result) { + case E_SHELL_CONSTRUCT_RESULT_OK: + return _("OK"); + case E_SHELL_CONSTRUCT_RESULT_INVALIDARG: + return _("Invalid arguments"); + case E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER: + return _("Cannot register on OAF"); + case E_SHELL_CONSTRUCT_RESULT_NOCONFIGDB: + return _("Configuration Database not found"); + case E_SHELL_CONSTRUCT_RESULT_GENERICERROR: + return _("Generic error"); + default: + return _("Unknown error"); + } +} + + E_MAKE_X_TYPE (e_shell, "EShell", EShell, class_init, init, PARENT_TYPE, POA_GNOME_Evolution_Shell__init, diff --git a/shell/e-shell.h b/shell/e-shell.h index 1f9406bd83..8aaa2d5060 100644 --- a/shell/e-shell.h +++ b/shell/e-shell.h @@ -78,14 +78,25 @@ struct _EShellClass { /* ID for registering the shell in the OAF name service. */ #define E_SHELL_OAFIID "OAFIID:GNOME_Evolution_Shell" +enum _EShellConstructResult { + E_SHELL_CONSTRUCT_RESULT_OK, + E_SHELL_CONSTRUCT_RESULT_INVALIDARG, + E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER, + E_SHELL_CONSTRUCT_RESULT_NOCONFIGDB, + E_SHELL_CONSTRUCT_RESULT_GENERICERROR +}; +typedef enum _EShellConstructResult EShellConstructResult; + + -GtkType e_shell_get_type (void); -gboolean e_shell_construct (EShell *shell, - const char *iid, - const char *local_directory, - gboolean show_splash); -EShell *e_shell_new (const char *local_directory, - gboolean show_splash); +GtkType e_shell_get_type (void); +EShellConstructResult e_shell_construct (EShell *shell, + const char *iid, + const char *local_directory, + gboolean show_splash); +EShell *e_shell_new (const char *local_directory, + gboolean show_splash, + EShellConstructResult *construct_result_return); EShellView *e_shell_create_view (EShell *shell, const char *uri); @@ -117,6 +128,9 @@ void e_shell_go_online (EShell *shell, Bonobo_ConfigDatabase e_shell_get_config_db (EShell *shell); + +const char *e_shell_construct_result_to_string (EShellConstructResult result); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/shell/main.c b/shell/main.c index 45add1d1f9..5520007a3e 100644 --- a/shell/main.c +++ b/shell/main.c @@ -87,7 +87,6 @@ static void development_warning (void) { GtkWidget *label, *warning_dialog; - int ret; warning_dialog = gnome_dialog_new ("Evolution " VERSION, GNOME_STOCK_BUTTON_OK, NULL); @@ -138,18 +137,18 @@ idle_cb (void *data) GSList *uri_list; GNOME_Evolution_Shell corba_shell; CORBA_Environment ev; + EShellConstructResult result; gboolean restored; CORBA_exception_init (&ev); uri_list = (GSList *) data; - shell = e_shell_new (evolution_directory, ! no_splash); + shell = e_shell_new (evolution_directory, ! no_splash, &result); g_free (evolution_directory); - if (shell == NULL) { + if (result == 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, _("Cannot access the Evolution shell.")); @@ -159,6 +158,13 @@ idle_cb (void *data) } restored = FALSE; + } else if (result != E_SHELL_CONSTRUCT_RESULT_OK) { + 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); |