diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | service/service.c | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 8d31d13..5661b5c 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ GLIB_GSETTINGS GTK_DOC_CHECK([1.15]) # Dependencies -PKG_CHECK_MODULES(glib, glib-2.0 >= 2.27.3) +PKG_CHECK_MODULES(glib, glib-2.0 >= 2.29.90) PKG_CHECK_MODULES(gio, gio-2.0) PKG_CHECK_MODULES(dbus, dbus-1) diff --git a/service/service.c b/service/service.c index 5e54604..b2ab1cf 100644 --- a/service/service.c +++ b/service/service.c @@ -19,6 +19,7 @@ * Author: Ryan Lortie <desrt@desrt.ca> */ +#include <glib-unix.h> #include <gio/gio.h> #include <string.h> #include <stdlib.h> @@ -419,6 +420,16 @@ name_lost (GDBusConnection *connection, exit (1); } +static gboolean +exit_service (gpointer data) +{ + DConfState *state = data; + + g_main_loop_quit (state->main_loop); + + return TRUE; +} + int main (void) { @@ -426,6 +437,7 @@ main (void) GBusType type; g_type_init (); + dconf_state_init (&state); if (state.is_session) @@ -433,6 +445,10 @@ main (void) else type = G_BUS_TYPE_SYSTEM; + g_unix_signal_add (SIGTERM, exit_service, &state); + g_unix_signal_add (SIGINT, exit_service, &state); + g_unix_signal_add (SIGHUP, exit_service, &state); + g_bus_own_name (type, "ca.desrt.dconf", G_BUS_NAME_OWNER_FLAGS_NONE, bus_acquired, name_acquired, name_lost, &state, NULL); |