Author: nick
Date: 2008-07-18 16:44:24 +0000 (Fri, 18 Jul 2008)
New Revision: 27341
Modified:
xfce4-settings/trunk/ChangeLog
xfce4-settings/trunk/TODO
xfce4-settings/trunk/configure.ac.in
xfce4-settings/trunk/xfce4-settings-helper/main.c
Log:
* xfce4-settings-helper/main.c, configure.ac.in: Properly quit
the main loop when a signal is received.
Modified: xfce4-settings/trunk/ChangeLog
===================================================================
--- xfce4-settings/trunk/ChangeLog 2008-07-18 14:48:17 UTC (rev 27340)
+++ xfce4-settings/trunk/ChangeLog 2008-07-18 16:44:24 UTC (rev 27341)
@@ -1,5 +1,10 @@
2008-07-18 Nick Schermer <[EMAIL PROTECTED]>
+ * xfce4-settings-helper/main.c, configure.ac.in: Properly quit
+ the main loop when a signal is received.
+
+2008-07-18 Nick Schermer <[EMAIL PROTECTED]>
+
* dialogs/mouse-settings/main.c: Allow editing the display name
of the device in the dialog. This way users can set usable names
for devices that are plugged.
Modified: xfce4-settings/trunk/TODO
===================================================================
--- xfce4-settings/trunk/TODO 2008-07-18 14:48:17 UTC (rev 27340)
+++ xfce4-settings/trunk/TODO 2008-07-18 16:44:24 UTC (rev 27341)
@@ -10,12 +10,6 @@
again) (Jannis)
-Accessibility Settings
-------------------------------------------------------------------------
-
- * Also show the values of the sliders and add tooltips.
-
-
Mouse Settings (Nick)
------------------------------------------------------------------------
@@ -25,8 +19,8 @@
Settings Helper
------------------------------------------------------------------------
- * Add signal watch to xfce4-setting-helper to quit the main loop when
- receiving a sigterm. (Nick)
+ * Check for an already running instance. This is quite easy with
+ a pid file, but I'm not sure that's a good solution...
Display Settings (Nick)
Modified: xfce4-settings/trunk/configure.ac.in
===================================================================
--- xfce4-settings/trunk/configure.ac.in 2008-07-18 14:48:17 UTC (rev
27340)
+++ xfce4-settings/trunk/configure.ac.in 2008-07-18 16:44:24 UTC (rev
27341)
@@ -60,7 +60,7 @@
dnl **********************************
dnl *** Check for standard headers ***
dnl **********************************
-AC_CHECK_HEADERS([errno.h memory.h math.h stdlib.h string.h unistd.h])
+AC_CHECK_HEADERS([errno.h memory.h math.h stdlib.h string.h unistd.h signal.h])
dnl ******************************
dnl *** Check for i18n support ***
Modified: xfce4-settings/trunk/xfce4-settings-helper/main.c
===================================================================
--- xfce4-settings/trunk/xfce4-settings-helper/main.c 2008-07-18 14:48:17 UTC
(rev 27340)
+++ xfce4-settings/trunk/xfce4-settings-helper/main.c 2008-07-18 16:44:24 UTC
(rev 27341)
@@ -29,6 +29,12 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
#include <glib.h>
#include <gtk/gtk.h>
@@ -43,8 +49,8 @@
-static gboolean opt_version = FALSE;
-static gboolean opt_debug = FALSE;
+static gboolean opt_version = FALSE;
+static gboolean opt_debug = FALSE;
static GOptionEntry option_entries[] =
{
{ "version", 'v', 0, G_OPTION_ARG_NONE, &opt_version, N_("Version
information"), NULL },
@@ -54,15 +60,26 @@
+static void
+signal_handler (gint signum)
+{
+ /* quit the main loop */
+ gtk_main_quit ();
+}
+
+
+
gint
main (gint argc, gchar **argv)
{
- GError *error = NULL;
- GObject *pointer_helper;
- GObject *keyboards_helper;
- GObject *accessibility_helper;
- GObject *shortcuts_helper;
- pid_t pid;
+ GError *error = NULL;
+ GObject *pointer_helper;
+ GObject *keyboards_helper;
+ GObject *accessibility_helper;
+ GObject *shortcuts_helper;
+ pid_t pid;
+ guint i;
+ const gint signums[] = { SIGHUP, SIGINT, SIGQUIT, SIGTERM };
/* setup translation domain */
xfce_textdomain (GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
@@ -104,6 +121,16 @@
return EXIT_SUCCESS;
}
+ /* initialize xfconf */
+ if (!xfconf_init (&error))
+ {
+ /* print error and exit */
+ g_error ("Failed to connect to xfconf daemon: %s.", error->message);
+ g_error_free (error);
+
+ return EXIT_FAILURE;
+ }
+
/* daemonize the process when not running in debug mode */
if (!opt_debug)
{
@@ -113,7 +140,7 @@
if (G_UNLIKELY (pid == -1))
{
/* show message and continue in normal mode */
- g_warning ("Failed to fork the process, starting in non-daemon
mode");
+ g_warning ("Failed to fork the process: %s. Continuing in
non-daemon mode.", g_strerror (errno));
}
else if (pid > 0)
{
@@ -122,22 +149,16 @@
}
}
- /* initialize xfconf */
- if (!xfconf_init (&error))
- {
- /* print error and exit */
- g_error ("Failed to connect to xfconf daemon: %s.", error->message);
- g_error_free (error);
-
- return EXIT_FAILURE;
- }
-
/* create the sub daemons */
pointer_helper = g_object_new (XFCE_TYPE_POINTERS_HELPER, NULL);
keyboards_helper = g_object_new (XFCE_TYPE_KEYBOARDS_HELPER, NULL);
accessibility_helper = g_object_new (XFCE_TYPE_ACCESSIBILITY_HELPER, NULL);
shortcuts_helper = g_object_new (XFCE_TYPE_KEYBOARD_SHORTCUTS_HELPER,
NULL);
+ /* 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();
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits