aboutsummaryrefslogtreecommitdiffstats
path: root/shell/main.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-12-07 22:40:32 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:41:09 +0800
commite5cade617627dd50cd39d341cc7764fc8809b5c9 (patch)
tree88fe1b3f5ad947ce0fffaff50b649ab2f967bdd9 /shell/main.c
parentb2d716da23bc2304f826dba86720dc2e28fbc212 (diff)
downloadgsoc2013-evolution-e5cade617627dd50cd39d341cc7764fc8809b5c9.tar.gz
gsoc2013-evolution-e5cade617627dd50cd39d341cc7764fc8809b5c9.tar.zst
gsoc2013-evolution-e5cade617627dd50cd39d341cc7764fc8809b5c9.zip
Bug #590245 - 'evolution --force-shutdown' should kill factories
Diffstat (limited to 'shell/main.c')
-rw-r--r--shell/main.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/shell/main.c b/shell/main.c
index b80283b6db..da7a235a0a 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -317,8 +317,36 @@ setup_segv_redirect (void)
g_static_mutex_lock (&segv_mutex);
}
+static void
+quit_signal (gint sig)
+{
+ EShell *shell;
+
+ g_return_if_fail (sig == SIGQUIT);
+
+ g_print ("Received quit signal...\n");
+
+ shell = e_shell_get_default ();
+ if (shell)
+ e_shell_quit (shell, E_SHELL_QUIT_OPTION);
+}
+
+static void
+setup_quit_signal (void)
+{
+ struct sigaction sa, osa;
+
+ sigaction (SIGQUIT, NULL, &osa);
+
+ sa.sa_flags = 0;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_handler = quit_signal;
+ sigaction (SIGQUIT, &sa, NULL);
+}
+
#else
#define setup_segv_redirect() (void)0
+#define setup_quit_signal() (void)0
#endif
static GOptionEntry entries[] = {
@@ -512,6 +540,17 @@ main (gint argc, gchar **argv)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
+ g_type_init ();
+ if (!g_thread_get_initialized ())
+ g_thread_init (NULL);
+
+ /* do not require Gtk+ for --force-shutdown */
+ if (argc == 2 && argv[1] && g_str_equal (argv[1], "--force-shutdown")) {
+ shell_force_shutdown ();
+
+ return 0;
+ }
+
#if HAVE_CLUTTER
gtk_clutter_init_with_args (
&argc, &argv,
@@ -532,10 +571,6 @@ main (gint argc, gchar **argv)
exit (1);
}
- g_type_init ();
- if (!g_thread_get_initialized ())
- g_thread_init (NULL);
-
#ifdef HAVE_ICAL_UNKNOWN_TOKEN_HANDLING
ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN);
#endif
@@ -623,6 +658,7 @@ main (gint argc, gchar **argv)
}
setup_segv_redirect ();
+ setup_quit_signal ();
if (evolution_debug_log) {
gint fd;