diff options
author | Colin Walters <walters@verbum.org> | 2012-12-03 13:53:44 -0500 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2013-01-22 11:56:26 -0500 |
commit | 4952f6e5b023428e5f11f763531533c7b262f324 (patch) | |
tree | 00b6aaa89047436a07c336df9535eb5dc4b8304d /gui/simple-greeter/greeter-main.c | |
parent | 59d705966a50fe796b5ba7414697aa503476a7ec (diff) | |
download | gdm-4952f6e5b023428e5f11f763531533c7b262f324.tar.gz |
Port to g_unix_signal_add(), drop GdmSignalHandler
The level of copy/paste going on here before is rather astonishing.
For example, in some cases, I dropped spurious handling of SIGHUP,
when the code didn't have any settings to reread.
Anyways, the code is now clearer, and we get to drop all the bits of
gdm-signal-handler.[ch] for the integrated GLib handling.
https://bugzilla.gnome.org/show_bug.cgi?id=676181
Diffstat (limited to 'gui/simple-greeter/greeter-main.c')
-rw-r--r-- | gui/simple-greeter/greeter-main.c | 57 |
1 files changed, 5 insertions, 52 deletions
diff --git a/gui/simple-greeter/greeter-main.c b/gui/simple-greeter/greeter-main.c index d83493e2..b17da46d 100644 --- a/gui/simple-greeter/greeter-main.c +++ b/gui/simple-greeter/greeter-main.c @@ -32,7 +32,6 @@ #include "gdm-log.h" #include "gdm-common.h" -#include "gdm-signal-handler.h" #include "gdm-settings-client.h" #include "gdm-settings-keys.h" #include "gdm-profile.h" @@ -67,54 +66,14 @@ is_debug_set (void) return debug; } - static gboolean -signal_cb (int signo, - gpointer data) +on_sigusr1_cb (gpointer user_data) { - int ret; - - g_debug ("Got callback for signal %d", signo); - - ret = TRUE; - - switch (signo) { - case SIGINT: - case SIGTERM: - /* let the fatal signals interrupt us */ - g_debug ("Caught signal %d, shutting down normally.", signo); - ret = FALSE; - - break; - - case SIGHUP: - g_debug ("Got HUP signal"); - /* FIXME: - * Reread config stuff like system config files, VPN service files, etc - */ - ret = TRUE; - - break; + g_debug ("Got USR1 signal"); - case SIGUSR1: - g_debug ("Got USR1 signal"); - /* FIXME: - * Play with log levels or something - */ - ret = TRUE; + gdm_log_toggle_debug (); - gdm_log_toggle_debug (); - - break; - - default: - g_debug ("Caught unhandled signal %d", signo); - ret = TRUE; - - break; - } - - return ret; + return TRUE; } static gboolean @@ -257,7 +216,6 @@ main (int argc, char *argv[]) GError *error; GdmGreeterSession *session; gboolean res; - GdmSignalHandler *signal_handler; bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); @@ -285,12 +243,7 @@ main (int argc, char *argv[]) gtk_init (&argc, &argv); - signal_handler = gdm_signal_handler_new (); - gdm_signal_handler_add_fatal (signal_handler); - gdm_signal_handler_add (signal_handler, SIGTERM, signal_cb, NULL); - gdm_signal_handler_add (signal_handler, SIGINT, signal_cb, NULL); - gdm_signal_handler_add (signal_handler, SIGHUP, signal_cb, NULL); - gdm_signal_handler_add (signal_handler, SIGUSR1, signal_cb, NULL); + g_unix_signal_add (SIGUSR1, on_sigusr1_cb, NULL); gdm_profile_start ("Creating new greeter session"); session = gdm_greeter_session_new (); |