[krb5-auth-dialog] Cleanup on SIGTERM and SIGQUIT
- From: Guido Günther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [krb5-auth-dialog] Cleanup on SIGTERM and SIGQUIT
- Date: Mon, 27 Oct 2014 12:59:38 +0000 (UTC)
commit a4d921f35cc65b14e4204cc855f0d2c3bbf68f29
Author: Guido Günther <agx sigxcpu org>
Date: Sun Oct 26 18:07:47 2014 +0100
Cleanup on SIGTERM and SIGQUIT
This makes sure we don't leave any old notifiations around
src/ka-applet.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/ka-applet.c b/src/ka-applet.c
index 92cd3e0..838e0eb 100644
--- a/src/ka-applet.c
+++ b/src/ka-applet.c
@@ -32,6 +32,8 @@
#include "ka-closures.h"
#include <libnotify/notify.h>
+#include <signal.h>
+
#define NOTIFY_SECONDS 300
enum ka_icon {
@@ -237,6 +239,30 @@ action_quit (GSimpleAction *action G_GNUC_UNUSED,
ka_applet_destroy (self);
}
+
+KaApplet *sigapplet;
+static void
+signal_handler (int signum)
+{
+ g_message ("Caught signal %d", signum);
+ if (sigapplet)
+ ka_applet_destroy (sigapplet);
+}
+
+
+static void
+setup_signal_handlers (KaApplet *applet)
+{
+ struct sigaction sa;
+
+ memset (&sa, 0, sizeof(sa));
+ sa.sa_handler = signal_handler;
+ sigapplet = applet;
+ sigaction(SIGINT, &sa, NULL);
+ sigaction(SIGTERM, &sa, NULL);
+}
+
+
static GActionEntry app_entries[] = {
{ "preferences", action_preferences, NULL, NULL, NULL, {0} },
{ "about", action_about, NULL, NULL, NULL, {0} },
@@ -1229,6 +1255,7 @@ main (int argc, char *argv[])
if (!applet)
return 1;
+ setup_signal_handlers(applet);
ret = g_application_run (G_APPLICATION(applet), argc, argv);
g_object_unref (applet);
return ret;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]