aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/e-shell.c')
-rw-r--r--shell/e-shell.c43
1 files changed, 32 insertions, 11 deletions
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.