aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-09-15 03:27:41 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-09-15 03:27:41 +0800
commit1b26832f1402c6e5f40aadb7a95e323fb5dac326 (patch)
treeefc9660871331f6f6d2cdaf0a3e66e7f94bb6996 /shell/e-shell.c
parentefa43cbf6f1e5902ea0b426eb6b7212e9096acb9 (diff)
downloadgsoc2013-evolution-1b26832f1402c6e5f40aadb7a95e323fb5dac326.tar
gsoc2013-evolution-1b26832f1402c6e5f40aadb7a95e323fb5dac326.tar.gz
gsoc2013-evolution-1b26832f1402c6e5f40aadb7a95e323fb5dac326.tar.bz2
gsoc2013-evolution-1b26832f1402c6e5f40aadb7a95e323fb5dac326.tar.lz
gsoc2013-evolution-1b26832f1402c6e5f40aadb7a95e323fb5dac326.tar.xz
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
Diffstat (limited to 'shell/e-shell.c')
-rw-r--r--shell/e-shell.c65
1 files changed, 54 insertions, 11 deletions
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;
}