diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-09-15 03:27:41 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-09-15 03:27:41 +0800 |
commit | 1b26832f1402c6e5f40aadb7a95e323fb5dac326 (patch) | |
tree | efc9660871331f6f6d2cdaf0a3e66e7f94bb6996 | |
parent | efa43cbf6f1e5902ea0b426eb6b7212e9096acb9 (diff) | |
download | gsoc2013-evolution-1b26832f1402c6e5f40aadb7a95e323fb5dac326.tar.gz gsoc2013-evolution-1b26832f1402c6e5f40aadb7a95e323fb5dac326.tar.zst gsoc2013-evolution-1b26832f1402c6e5f40aadb7a95e323fb5dac326.zip |
[Fix #8204 and the other bugs caused by allowing invocations on
the ::Shell interface to happen before the shell is actually fully
initialized. This is a lame hack and not a nice, complete
solution for the problem, but it should do for now.]
* e-shell.c: New member `is_initialized' in `EShellPrivate'.
(init): Initialize to %FALSE.
(e_shell_construct): Set `is_initialized' to %TRUE after the
initialization sequence is finished.
(raise_exception_if_not_ready): New utility function to raise the
notReady exception if the shell is not ready.
(impl_Shell__get_displayName): Call it.
(impl_Shell_getComponentByType): Likewise.
(impl_Shell_createNewView): Likewise.
(impl_Shell_handleURI): Likewise.
(impl_Shell_selectUserFolder): Likewise.
(impl_Shell_getLocalStorage): Likewise.
(impl_Shell_createStorageSetView): Likewise.
(impl_Shell_setLineStatus): Likewise.
(e_shell_construct): Print out the repo_id of the exception from
`bonobo_get_object()' if it fails. Also, register on OAF just
before displaying the splash.
* Evolution-Shell.idl: New exception `NotReady'. All the CORBA
methods on ::Shell can now raise this exception.
svn path=/trunk/; revision=12826
-rw-r--r-- | shell/ChangeLog | 28 | ||||
-rw-r--r-- | shell/Evolution-Shell.idl | 18 | ||||
-rw-r--r-- | shell/e-shell.c | 65 |
3 files changed, 93 insertions, 18 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index d96c0eb209..41cdfff280 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,31 @@ +2001-09-14 Ettore Perazzoli <ettore@ximian.com> + + [Fix #8204 and the other bugs caused by allowing invocations on + the ::Shell interface to happen before the shell is actually fully + initialized. This is a lame hack and not a nice, complete + solution for the problem, but it should do for now.] + + * e-shell.c: New member `is_initialized' in `EShellPrivate'. + (init): Initialize to %FALSE. + (e_shell_construct): Set `is_initialized' to %TRUE after the + initialization sequence is finished. + (raise_exception_if_not_ready): New utility function to raise the + notReady exception if the shell is not ready. + (impl_Shell__get_displayName): Call it. + (impl_Shell_getComponentByType): Likewise. + (impl_Shell_createNewView): Likewise. + (impl_Shell_handleURI): Likewise. + (impl_Shell_selectUserFolder): Likewise. + (impl_Shell_getLocalStorage): Likewise. + (impl_Shell_createStorageSetView): Likewise. + (impl_Shell_setLineStatus): Likewise. + (e_shell_construct): Print out the repo_id of the exception from + `bonobo_get_object()' if it fails. Also, register on OAF just + before displaying the splash. + + * Evolution-Shell.idl: New exception `NotReady'. All the CORBA + methods on ::Shell can now raise this exception. + 2001-09-13 Ettore Perazzoli <ettore@ximian.com> [Fix #5990, Remembering Evolution window geometry.] diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl index 92a428fdbf..7d8889b463 100644 --- a/shell/Evolution-Shell.idl +++ b/shell/Evolution-Shell.idl @@ -17,6 +17,7 @@ module Evolution { interface FolderSelectionListener; interface Shell : Bonobo::Unknown { + exception NotReady {}; exception NotFound {}; exception UnsupportedSchema {}; exception InvalidURI {}; @@ -38,7 +39,7 @@ module Evolution { * handles @type. */ ShellComponent getComponentByType (in string type) - raises (NotFound); + raises (NotReady, NotFound); /** * createNewView: @@ -47,7 +48,7 @@ module Evolution { * Return value: the new view. */ ShellView createNewView (in string uri) - raises (NotFound, UnsupportedSchema, InvalidURI, InternalError); + raises (NotReady, NotFound, UnsupportedSchema, InvalidURI, InternalError); /** * handleURI: @@ -59,7 +60,7 @@ module Evolution { * the message composer.) */ void handleURI (in string uri) - raises (NotFound, UnsupportedSchema, InvalidURI, InternalError); + raises (NotReady, NotFound, UnsupportedSchema, InvalidURI, InternalError); /** * selectUserFolder: @@ -78,7 +79,7 @@ module Evolution { in string title, in string default_folder, in FolderTypeNameList possible_types) - raises (Busy); + raises (NotReady, Busy); /** * getLocalStorage: @@ -90,7 +91,8 @@ module Evolution { * * Return value: the `Evolution::LocalStorage' interface for * the local storage. */ - Storage getLocalStorage (); + Storage getLocalStorage () + raises (NotReady); /** * createStorageSetView: @@ -100,14 +102,16 @@ module Evolution { * * Return value: the newly created control. */ - Bonobo::Control createStorageSetView (); + Bonobo::Control createStorageSetView () + raises (NotReady); /** * setLineStatus: * * Set the shell into on-line or off-line mode. */ - void setLineStatus (in boolean online); + void setLineStatus (in boolean online) + raises (NotReady); }; interface FolderSelectionListener { diff --git a/shell/e-shell.c b/shell/e-shell.c index 812b585387..34f1851230 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -116,7 +116,7 @@ struct _EShellPrivate { /* Whether the shell is succesfully initialized. This is needed during the start-up sequence, to avoid CORBA calls to do make wrong things to happen while the shell is initializing. */ - gboolean is_initialized; + unsigned int is_initialized : 1; }; @@ -196,6 +196,23 @@ folder_selection_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_ /* CORBA interface implementation. */ +static gboolean +raise_exception_if_not_ready (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + EShell *shell; + + shell = E_SHELL (bonobo_object_from_servant (servant)); + + if (! shell->priv->is_initialized) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_GNOME_Evolution_Shell_NotReady, NULL); + return TRUE; + } + + return FALSE; +} + static CORBA_char * impl_Shell__get_displayName (PortableServer_Servant servant, CORBA_Environment *ev) @@ -203,6 +220,9 @@ impl_Shell__get_displayName (PortableServer_Servant servant, char *display_string; CORBA_char *retval; + if (raise_exception_if_not_ready (servant, ev)) + return; + display_string = DisplayString (gdk_display); if (display_string == NULL) return CORBA_string_dup (""); @@ -224,6 +244,9 @@ impl_Shell_getComponentByType (PortableServer_Servant servant, GNOME_Evolution_ShellComponent corba_component; EShell *shell; + if (raise_exception_if_not_ready (servant, ev)) + return; + bonobo_object = bonobo_object_from_servant (servant); shell = E_SHELL (bonobo_object); folder_type_registry = shell->priv->folder_type_registry; @@ -251,6 +274,9 @@ impl_Shell_createNewView (PortableServer_Servant servant, EShellView *shell_view; GNOME_Evolution_ShellView shell_view_interface; + if (raise_exception_if_not_ready (servant, ev)) + return; + bonobo_object = bonobo_object_from_servant (servant); shell = E_SHELL (bonobo_object); @@ -292,6 +318,9 @@ impl_Shell_handleURI (PortableServer_Servant servant, const char *colon_p; char *schema; + if (raise_exception_if_not_ready (servant, ev)) + return; + shell = E_SHELL (bonobo_object_from_servant (servant)); priv = shell->priv; @@ -355,6 +384,9 @@ impl_Shell_selectUserFolder (PortableServer_Servant servant, const char **allowed_type_names; int i; + if (raise_exception_if_not_ready (servant, ev)) + return; + bonobo_object = bonobo_object_from_servant (servant); shell = E_SHELL (bonobo_object); @@ -393,6 +425,9 @@ impl_Shell_getLocalStorage (PortableServer_Servant servant, EShell *shell; EShellPrivate *priv; + if (raise_exception_if_not_ready (servant, ev)) + return; + bonobo_object = bonobo_object_from_servant (servant); shell = E_SHELL (bonobo_object); priv = shell->priv; @@ -412,6 +447,9 @@ impl_Shell_createStorageSetView (PortableServer_Servant servant, EShell *shell; BonoboControl *control; + if (raise_exception_if_not_ready (servant, ev)) + return; + bonobo_object = bonobo_object_from_servant (servant); shell = E_SHELL (bonobo_object); @@ -428,6 +466,9 @@ impl_Shell_setLineStatus (PortableServer_Servant servant, BonoboObject *bonobo_object; EShell *shell; + if (raise_exception_if_not_ready (servant, ev)) + return; + bonobo_object = bonobo_object_from_servant (servant); shell = E_SHELL (bonobo_object); @@ -899,7 +940,7 @@ e_shell_construct (EShell *shell, 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:"); + g_warning ("Cannot access Bonobo/ConfigDatabase on wombat: (%s)", ev._repo_id); /* Make sure the DB object is NIL so we don't mess up (`bonobo_get_object()' might return an undefined value in @@ -921,6 +962,16 @@ e_shell_construct (EShell *shell, gtk_widget_show (splash); } + /* Now we can register into OAF. Notice that we shouldn't be + registering into OAF until we are sure we can complete. */ + + /* FIXME: Multi-display stuff. */ + 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 E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER; + } + while (gtk_events_pending ()) gtk_main_iteration (); @@ -981,15 +1032,7 @@ e_shell_construct (EShell *shell, g_free (shortcut_path); - /* Now we can register into OAF. Notice that we shouldn't be - registering into OAF until we are initialized. */ - - /* FIXME: Multi-display stuff. */ - 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 E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER; - } + priv->is_initialized = TRUE; return E_SHELL_CONSTRUCT_RESULT_OK; } |