Browse Source

Add signal handler for SIGTERM and friends.

tags/xfce4-panel-4.10.0
Nick Schermer 11 years ago
parent
commit
2620eda582
3 changed files with 31 additions and 1 deletions
  1. +4
    -0
      TODO
  2. +1
    -1
      configure.in.in
  3. +26
    -0
      panel/main.c

+ 4
- 0
TODO View File

@@ -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.


+ 1
- 1
configure.in.in View File

@@ -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 ***


+ 26
- 0
panel/main.c View File

@@ -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 ();


Loading…
Cancel
Save