aboutsummaryrefslogtreecommitdiffstats
path: root/shell/killev.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-12-07 22:40:32 +0800
committerMilan Crha <mcrha@redhat.com>2010-12-07 22:40:32 +0800
commit7ddb3931b153c95641712a1e79732a359311bcec (patch)
treef8793932343ef2b04a0298330ab096f9c78c2567 /shell/killev.c
parent5052552b83d1df9b7578adf6716a34d05032b8ca (diff)
downloadgsoc2013-evolution-7ddb3931b153c95641712a1e79732a359311bcec.tar
gsoc2013-evolution-7ddb3931b153c95641712a1e79732a359311bcec.tar.gz
gsoc2013-evolution-7ddb3931b153c95641712a1e79732a359311bcec.tar.bz2
gsoc2013-evolution-7ddb3931b153c95641712a1e79732a359311bcec.tar.lz
gsoc2013-evolution-7ddb3931b153c95641712a1e79732a359311bcec.tar.xz
gsoc2013-evolution-7ddb3931b153c95641712a1e79732a359311bcec.tar.zst
gsoc2013-evolution-7ddb3931b153c95641712a1e79732a359311bcec.zip
Bug #590245 - 'evolution --force-shutdown' should kill factories
Diffstat (limited to 'shell/killev.c')
-rw-r--r--shell/killev.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/shell/killev.c b/shell/killev.c
index 16849eec42..948523dccb 100644
--- a/shell/killev.c
+++ b/shell/killev.c
@@ -94,6 +94,18 @@ exit:
return success;
}
+static void
+kill_factories (void)
+{
+ #ifdef KILL_PROCESS_CMD
+
+ system (KILL_PROCESS_CMD " -QUIT evolution 2> /dev/null");
+ system (KILL_PROCESS_CMD " -QUIT e-calendar-factory 2> /dev/null");
+ system (KILL_PROCESS_CMD " -QUIT e-addressbook-factory 2> /dev/null");
+
+ #endif
+}
+
gint
main (gint argc, gchar **argv)
{
@@ -116,17 +128,27 @@ main (gint argc, gchar **argv)
if (!get_evolution_pid (pid_file)) {
g_printerr ("Could not find Evolution's process ID\n");
+ kill_factories ();
exit (EXIT_FAILURE);
}
- /* Play it safe here and bail if something goes wrong. We don't
- * want to just skip to the killing if we can't ask Evolution to
- * terminate gracefully. Despite our name we actually want to
- * -avoid- killing Evolution if at all possible. */
- if (!g_spawn_command_line_async ("evolution --quit", &error)) {
- g_printerr ("%s", error->message);
- g_error_free (error);
- exit (EXIT_FAILURE);
+ if (g_getenv ("DISPLAY") == NULL) {
+ #ifdef KILL_PROCESS_CMD
+
+ system (KILL_PROCESS_CMD " -QUIT evolution 2> /dev/null");
+
+ #endif
+ } else {
+ /* Play it safe here and bail if something goes wrong. We don't
+ * want to just skip to the killing if we can't ask Evolution to
+ * terminate gracefully. Despite our name we actually want to
+ * -avoid- killing Evolution if at all possible. */
+ if (!g_spawn_command_line_async ("evolution --quit", &error)) {
+ g_printerr ("%s", error->message);
+ g_error_free (error);
+ kill_factories ();
+ exit (EXIT_FAILURE);
+ }
}
/* Now we set up a monitor on Evolution's .running file.
@@ -136,6 +158,7 @@ main (gint argc, gchar **argv)
if (error != NULL) {
g_printerr ("%s", error->message);
g_error_free (error);
+ kill_factories ();
exit (EXIT_FAILURE);
}
@@ -155,5 +178,7 @@ main (gint argc, gchar **argv)
g_object_unref (monitor);
+ kill_factories ();
+
return EXIT_SUCCESS;
}