aboutsummaryrefslogtreecommitdiffstats
path: root/shell/killev.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/killev.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/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;
}