aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog12
-rw-r--r--shell/e-shell.c43
-rw-r--r--shell/e-shell.h4
-rw-r--r--shell/main.c19
4 files changed, 66 insertions, 12 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 01e31ac4a3..1f4a95bdd2 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,15 @@
+2008-01-03 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #219197
+
+ * e-shell.h:
+ * e-shell.c: (e_shell_can_quit), (e_shell_do_quit), (e_shell_quit):
+ Call of e_shell_quit divided into two functions, one to check if quit
+ is acceptable by all components and second to do quit.
+ * main.c: (gnome_master_client_save_yourself_cb),
+ (gnome_master_client_die_cb), (main):
+ Quit application when session dies.
+
2007-12-10 Srinivasa Ragavan <sragavan@novell.com>
** Fix for bug #502501
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 51ab69c8c1..cd34d2e03d 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -1334,7 +1334,7 @@ es_run_quit(EShell *shell)
}
gboolean
-e_shell_quit(EShell *shell)
+e_shell_can_quit (EShell *shell)
{
EShellPrivate *priv;
GSList *component_infos;
@@ -1368,23 +1368,44 @@ e_shell_quit(EShell *shell)
break;
}
- if (can_quit) {
- GList *p = shell->priv->windows;
+ return can_quit;
+}
- for (; p != NULL; p = p->next) {
- gtk_widget_set_sensitive (GTK_WIDGET (p->data), FALSE);
- if (p == shell->priv->windows)
- e_shell_window_save_defaults (p->data);
- }
- can_quit = !es_run_quit(shell);
+gboolean
+e_shell_do_quit (EShell *shell)
+{
+ EShellPrivate *priv;
+ GList *p;
+ gboolean can_quit;
+
+ g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
+
+ priv = shell->priv;
- /* Mark a safe quit by destroying the lock. */
- e_file_lock_destroy ();
+ if (priv->preparing_to_quit)
+ return FALSE;
+
+ for (p = shell->priv->windows; p != NULL; p = p->next) {
+ gtk_widget_set_sensitive (GTK_WIDGET (p->data), FALSE);
+
+ if (p == shell->priv->windows)
+ e_shell_window_save_defaults (p->data);
}
+ can_quit = !es_run_quit (shell);
+
+ /* Mark a safe quit by destroying the lock. */
+ e_file_lock_destroy ();
+
return can_quit;
}
+gboolean
+e_shell_quit (EShell *shell)
+{
+ return e_shell_can_quit (shell) && e_shell_do_quit (shell);
+}
+
/**
* gboolean (*EMainShellFunc) (EShell *shell, EShellWindow *window, gpointer user_data);
* Function used in @ref e_shell_foreach_shell_window.
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 2cd9921af0..958bb33581 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -129,7 +129,9 @@ void e_shell_show_settings (EShell *shell,
const char *type,
EShellWindow *shell_window);
-gboolean e_shell_quit (EShell *shell);
+gboolean e_shell_can_quit (EShell *shell);
+gboolean e_shell_do_quit (EShell *shell);
+gboolean e_shell_quit (EShell *shell);
const char *e_shell_construct_result_to_string (EShellConstructResult result);
diff --git a/shell/main.c b/shell/main.c
index bbbd27d62c..8041c73043 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -61,6 +61,7 @@
#include <libgnome/gnome-util.h>
#include <libgnome/gnome-sound.h>
#include <libgnomeui/gnome-ui-init.h>
+#include <libgnomeui/gnome-client.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-moniker-util.h>
@@ -549,6 +550,18 @@ setup_segv_redirect (void)
#define setup_segv_redirect() 0
#endif
+static gint
+gnome_master_client_save_yourself_cb (GnomeClient *client, GnomeSaveStyle save_style, gint shutdown, GnomeInteractStyle interact_style, gint fast, gpointer user_data)
+{
+ return !shell || e_shell_can_quit (shell);
+}
+
+static void
+gnome_master_client_die_cb (GnomeClient *client)
+{
+ e_shell_do_quit (shell);
+}
+
static const GOptionEntry options[] = {
{ "component", 'c', 0, G_OPTION_ARG_STRING, &default_component_id,
N_("Start Evolution activating the specified component"), NULL },
@@ -588,6 +601,7 @@ main (int argc, char **argv)
gboolean skip_warning_dialog;
#endif
GnomeProgram *program;
+ GnomeClient *master_client;
GOptionContext *context;
char *filename;
@@ -657,6 +671,11 @@ main (int argc, char **argv)
g_warning ("Could not set up debugging output file.");
}
+ master_client = gnome_master_client ();
+
+ g_signal_connect (G_OBJECT (master_client), "save_yourself", G_CALLBACK (gnome_master_client_save_yourself_cb), NULL);
+ g_signal_connect (G_OBJECT (master_client), "die", G_CALLBACK (gnome_master_client_die_cb), NULL);
+
glade_init ();
e_cursors_init ();
e_icon_factory_init ();