diff options
author | Ted Gould <ted@gould.cx> | 2013-08-20 16:21:16 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2013-08-20 16:21:16 -0500 |
commit | 4d6aeed8706bb67e884e9df4bca8a78e2edba014 (patch) | |
tree | 78c7c9b294650211b276b1265ef6d7047c17afc3 | |
parent | 3f6abe759b6976d606f97b894c02b68e1c0d9254 (diff) | |
download | ayatana-indicator-messages-4d6aeed8706bb67e884e9df4bca8a78e2edba014.tar.gz ayatana-indicator-messages-4d6aeed8706bb67e884e9df4bca8a78e2edba014.tar.bz2 ayatana-indicator-messages-4d6aeed8706bb67e884e9df4bca8a78e2edba014.zip |
Adding in a sigterm handler
-rw-r--r-- | src/messages-service.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/messages-service.c b/src/messages-service.c index 71fa09b..0eec2ad 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -25,6 +25,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <locale.h> #include <gio/gio.h> #include <glib/gi18n.h> +#include <glib-unix.h> #include "dbus-data.h" #include "gsettingsstrv.h" @@ -169,6 +170,16 @@ on_name_lost (GDBusConnection *bus, g_main_loop_quit (mainloop); } +static gboolean +sig_term_handler (gpointer user_data) +{ + GMainLoop *mainloop = user_data; + + g_main_loop_quit (mainloop); + + return FALSE; +} + int main (int argc, char ** argv) { @@ -225,6 +236,8 @@ main (int argc, char ** argv) g_hash_table_insert (menus, "phone", im_phone_menu_new (applications)); g_hash_table_insert (menus, "desktop", im_desktop_menu_new (applications)); + g_unix_signal_add(SIGTERM, sig_term_handler, mainloop); + g_main_loop_run(mainloop); /* Clean up */ |