aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-05-16 05:41:51 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-05-16 05:41:51 +0800
commit3d386b57d1682ad0f5fb0b9a60f0d65906f578b7 (patch)
tree67f79ba63a89ee7f5e1e463b8b4e082bfca83620 /shell/e-shell.c
parentc1ce3633db69de57b4a589587627fa088f9a3e5f (diff)
downloadgsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.tar
gsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.tar.gz
gsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.tar.bz2
gsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.tar.lz
gsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.tar.xz
gsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.tar.zst
gsoc2013-evolution-3d386b57d1682ad0f5fb0b9a60f0d65906f578b7.zip
Check with e_shell_prepare_for_quit() before quitting.
* e-shell-view-menu.c (command_quit): Check with e_shell_prepare_for_quit() before quitting. * e-shell.c (e_shell_prepare_for_quit): New. * evolution-test-component.c (request_quit_fn): New function asking for confirmation to quit. * evolution-shell-component.c (evolution_shell_component_new): New arg @request_quit_fn. (impl_requestQuit): New, implementation for EvolutionShellComponent::requestQuit. (evolution_shell_component_result_to_string): Handle EVOLUTION_SHELL_COMPONENT_CANCEL. (evolution_shell_component_client_request_quit): New. * Evolution-ShellComponent.idl (requestQuit): New. * component-factory.c (create_component): Pass NULL as @request_quit_fn. * component-factory.c (create_component): Pass NULL as @request_quit_fn. * gui/component-factory.c (create_object): Pass NULL as @request_quit_fn. * gui/component/addressbook-component.c (create_component): Pass NULL as @request_quit_fn. svn path=/trunk/; revision=16925
Diffstat (limited to 'shell/e-shell.c')
-rw-r--r--shell/e-shell.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/shell/e-shell.c b/shell/e-shell.c
index ff227dbb23..6353a45f55 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -70,6 +70,7 @@
#include "e-splash.h"
#include "e-uri-schema-registry.h"
+#include "evolution-shell-component-client.h"
#include "evolution-shell-component-utils.h"
#include "evolution-storage-set-view-factory.h"
@@ -2145,6 +2146,69 @@ e_shell_construct_result_to_string (EShellConstructResult result)
}
+static void
+prepare_for_quit_callback (EvolutionShellComponentClient *client,
+ EvolutionShellComponentResult result,
+ void *data)
+{
+ GNOME_Evolution_ShellComponentListener_Result *result_return;
+
+ result_return = (GNOME_Evolution_ShellComponentListener_Result *) data;
+ *result_return = result;
+}
+
+gboolean
+e_shell_prepare_for_quit (EShell *shell)
+{
+ EShellPrivate *priv;
+ GList *component_ids;
+ GList *p;
+ gboolean retval;
+
+ g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
+
+ priv = shell->priv;
+
+ /* Make all the views insensitive so we have some modal-like
+ behavior. */
+ for (p = priv->views; 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);
+
+ result = (GNOME_Evolution_ShellComponentListener_Result) -1;
+
+ evolution_shell_component_client_request_quit (client, prepare_for_quit_callback, &result);
+
+ while (result == (GNOME_Evolution_ShellComponentListener_Result) -1)
+ gtk_main_iteration ();
+
+ if (result != GNOME_Evolution_ShellComponentListener_OK) {
+ retval = FALSE;
+ goto end;
+ }
+ }
+
+ retval = TRUE;
+
+ end:
+ /* Restore all the views to be sensitive. */
+ for (p = priv->views; p != NULL; p = p->next)
+ gtk_widget_set_sensitive (GTK_WIDGET (p->data), TRUE);
+
+ e_free_string_list (component_ids);
+ return retval;
+}
+
+
E_MAKE_X_TYPE (e_shell, "EShell", EShell,
class_init, init, PARENT_TYPE,
POA_GNOME_Evolution_Shell__init,