From 56ac1ec642fb0713434132a76186290018569f67 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Thu, 4 Dec 2003 23:12:28 +0000 Subject: Implement. * e-shell.c (e_shell_prepare_for_quit): Implement. * Evolution-Component.idl (Component::requestQuit): Make sync [i.e. just return a boolean instead of using a BonoboListener]. svn path=/trunk/; revision=23639 --- shell/ChangeLog | 7 ++++++ shell/Evolution-Component.idl | 8 +++---- shell/e-shell.c | 50 ++++++++++++++++--------------------------- 3 files changed, 29 insertions(+), 36 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 2637f005cc..8778f271e1 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,10 @@ +2003-12-04 Ettore Perazzoli + + * e-shell.c (e_shell_prepare_for_quit): Implement. + + * Evolution-Component.idl (Component::requestQuit): Make sync + [i.e. just return a boolean instead of using a BonoboListener]. + 2003-12-03 Ettore Perazzoli [Fix for #51619.] diff --git a/shell/Evolution-Component.idl b/shell/Evolution-Component.idl index 97c3e6ad3a..e199629066 100644 --- a/shell/Evolution-Component.idl +++ b/shell/Evolution-Component.idl @@ -43,11 +43,9 @@ module Evolution { out Bonobo::Control statusbar_control) raises (Failed); - /* Request the component to quit. The component will reply - with an event named "quit", with a boolean value of TRUE if - the component agrees to quit and FALSE if it doesn't want - to. */ - void requestQuit (in Bonobo::Listener listener); + /* Request the component to quit. The component will return TRUE + if it agrees to quit and FALSE if it doesn't want to. */ + boolean requestQuit (); /* Notify the component of whether the shell is currently running in interactive mode or not. (I.e. basically, diff --git a/shell/e-shell.c b/shell/e-shell.c index e5e7281361..7da688d100 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -1016,15 +1016,11 @@ e_shell_construct_result_to_string (EShellConstructResult result) gboolean e_shell_prepare_for_quit (EShell *shell) { - /* FIXME TODO */ - - return TRUE; - -#if 0 EShellPrivate *priv; - GList *component_ids; + GSList *component_infos; GList *p; - gboolean retval; + GSList *sp; + CORBA_boolean can_quit; g_return_val_if_fail (E_IS_SHELL (shell), FALSE); @@ -1036,40 +1032,32 @@ e_shell_prepare_for_quit (EShell *shell) for (p = priv->windows; p != NULL; p = p->next) gtk_widget_set_sensitive (GTK_WIDGET (p->data), FALSE); - component_ids = e_component_registry_get_id_list (priv->component_registry); - - for (p = component_ids; p != NULL; p = p->next) { - EvolutionShellComponentClient *client; - const char *id; - GNOME_Evolution_ShellComponentListener_Result result; - - id = (const char *) p->data; - client = e_component_registry_get_component_by_id (priv->component_registry, id); + component_infos = e_component_registry_peek_list (priv->component_registry); + can_quit = TRUE; + for (sp = component_infos; sp != NULL; sp = sp->next) { + EComponentInfo *info = sp->data; + CORBA_Environment ev; - result = (GNOME_Evolution_ShellComponentListener_Result) -1; + CORBA_exception_init (&ev); - evolution_shell_component_client_request_quit (client, prepare_for_quit_callback, &result); + can_quit = GNOME_Evolution_Component_requestQuit (info->iface, &ev); + if (BONOBO_EX (&ev)) { + /* The component might not implement the interface, in which case we assume we can quit. */ + can_quit = TRUE; + } - while (result == (GNOME_Evolution_ShellComponentListener_Result) -1) - gtk_main_iteration (); + CORBA_exception_free (&ev); - if (result == GNOME_Evolution_ShellComponentListener_CANCEL) { - retval = FALSE; - goto end; - } + if (! can_quit) + break; } - retval = TRUE; - - end: /* Restore all the windows to be sensitive. */ for (p = priv->windows; p != NULL; p = p->next) gtk_widget_set_sensitive (GTK_WIDGET (p->data), TRUE); - priv->preparing_to_quit = FALSE; - e_free_string_list (component_ids); - return retval; -#endif + priv->preparing_to_quit = FALSE; + return can_quit; } -- cgit v1.2.3