diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-07-02 23:18:01 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-07-02 23:18:01 +0800 |
commit | 05724f4273c8b76ce3b2bd98def409de7e6d107e (patch) | |
tree | cd099a319e94c11016b7f405d360ffa2ff807cae /shell | |
parent | ae1f880dd8b49003a8c0ec51e977bad5bc6d5329 (diff) | |
download | gsoc2013-evolution-05724f4273c8b76ce3b2bd98def409de7e6d107e.tar gsoc2013-evolution-05724f4273c8b76ce3b2bd98def409de7e6d107e.tar.gz gsoc2013-evolution-05724f4273c8b76ce3b2bd98def409de7e6d107e.tar.bz2 gsoc2013-evolution-05724f4273c8b76ce3b2bd98def409de7e6d107e.tar.lz gsoc2013-evolution-05724f4273c8b76ce3b2bd98def409de7e6d107e.tar.xz gsoc2013-evolution-05724f4273c8b76ce3b2bd98def409de7e6d107e.tar.zst gsoc2013-evolution-05724f4273c8b76ce3b2bd98def409de7e6d107e.zip |
killev.c: Don't kill D-Bus services.
Evolution is no longer a privileged D-Bus client. Only terminate
Evolution, not the D-Bus services that other clients may be using.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/killev.c | 61 |
1 files changed, 25 insertions, 36 deletions
diff --git a/shell/killev.c b/shell/killev.c index 9c99130762..11afdc4098 100644 --- a/shell/killev.c +++ b/shell/killev.c @@ -94,18 +94,6 @@ 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) @@ -114,6 +102,7 @@ main (gint argc, GFileMonitor *monitor; const gchar *user_config_dir; gchar *filename; + gint retval = EXIT_SUCCESS; GError *error = NULL; bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR); @@ -129,27 +118,22 @@ main (gint argc, if (!get_evolution_pid (pid_file)) { g_printerr ("Could not find Evolution's process ID\n"); - kill_factories (); - exit (EXIT_FAILURE); + retval = EXIT_FAILURE; + goto kill; } - 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); - } + if (g_getenv ("DISPLAY") == NULL) + goto kill; + + /* 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\n", error->message); + g_error_free (error); + retval = EXIT_FAILURE; + goto kill; } /* Now we set up a monitor on Evolution's .running file. @@ -157,10 +141,10 @@ main (gint argc, * file just before terminating and we'll be notified. */ monitor = g_file_monitor_file (pid_file, 0, NULL, &error); if (error != NULL) { - g_printerr ("%s", error->message); + g_printerr ("%s\n", error->message); g_error_free (error); - kill_factories (); - exit (EXIT_FAILURE); + retval = EXIT_FAILURE; + goto kill; } g_signal_connect ( @@ -179,7 +163,12 @@ main (gint argc, g_object_unref (monitor); - kill_factories (); +kill: +#ifdef KILL_PROCESS_CMD + system (KILL_PROCESS_CMD " -QUIT evolution 2> /dev/null"); +#else + g_printerr ("No \"kill\" command available.\n"); +#endif - return EXIT_SUCCESS; + return retval; } |