[Xfce4-commits] <xfce4-panel:devel> * Update TODO * Add signal handler for SIGTERM and friends
Nick Schermer
nick at xfce.org
Tue Aug 11 20:22:41 CEST 2009
Updating branch refs/heads/devel
to ba764cec5c961024006c91e5099b6b5fc60dca06 (commit)
from bb1582b4c68761243dd13d1b7e9f2767616cfd80 (commit)
commit ba764cec5c961024006c91e5099b6b5fc60dca06
Author: Nick Schermer <nick at xfce.org>
Date: Sat Aug 2 19:47:45 2008 +0200
* Update TODO
* Add signal handler for SIGTERM and friends
TODO | 4 ++++
configure.in.in | 2 +-
panel/main.c | 26 ++++++++++++++++++++++++++
3 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/TODO b/TODO
index 8a4cf93..09d7971 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,10 @@
Things to do for Xfce Panel
===========================
+Pick From Trunk
+---------------
+ - Clock +1 px width
+
General
-------
- Fix all the code with TODO in the comment.
diff --git a/configure.in.in b/configure.in.in
index 83337a6..2d90a12 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -83,7 +83,7 @@ dnl *** Check for standard headers ***
dnl **********************************
AC_HEADER_STDC()
AC_CHECK_HEADERS([stdlib.h unistd.h locale.h stdio.h errno.h time.h string.h \
- math.h sys/types.h sys/wait.h memory.h])
+ math.h sys/types.h sys/wait.h memory.h signal.h])
dnl ******************************
dnl *** Check for i18n support ***
diff --git a/panel/main.c b/panel/main.c
index 2769bfc..71a57b9 100644
--- a/panel/main.c
+++ b/panel/main.c
@@ -25,6 +25,12 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
#include <glib.h>
#include <libxfce4util/libxfce4util.h>
@@ -65,6 +71,20 @@ static GOptionEntry option_entries[] =
+static void
+signal_handler (gint signum)
+{
+ extern gboolean dbus_quit_with_restart;
+
+ /* don't try to restart */
+ dbus_quit_with_restart = FALSE;
+
+ /* quit the main loop */
+ gtk_main_quit ();
+}
+
+
+
gint
main (gint argc, gchar **argv)
{
@@ -73,6 +93,8 @@ main (gint argc, gchar **argv)
GObject *dbus_service;
extern gboolean dbus_quit_with_restart;
gboolean result;
+ guint i;
+ const gint signums[] = { SIGHUP, SIGINT, SIGQUIT, SIGTERM };
/* set translation domain */
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
@@ -175,6 +197,10 @@ main (gint argc, gchar **argv)
/* create dbus service */
dbus_service = panel_dbus_service_new ();
+
+ /* setup signal handlers to properly quit the main loop */
+ for (i = 0; i < G_N_ELEMENTS (signums); i++)
+ signal (signums[i], signal_handler);
/* enter the main loop */
gtk_main ();
More information about the Xfce4-commits
mailing list