diff options
-rw-r--r-- | applets/Makefile.am | 2 | ||||
-rw-r--r-- | applets/exit/Makefile.am | 13 | ||||
-rw-r--r-- | applets/exit/exit.c | 35 | ||||
-rw-r--r-- | configure.ac | 1 |
4 files changed, 50 insertions, 1 deletions
diff --git a/applets/Makefile.am b/applets/Makefile.am index 897b13d..8310820 100644 --- a/applets/Makefile.am +++ b/applets/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = brightness clock launcher notify systray showdesktop windowselector +SUBDIRS = brightness clock exit launcher notify systray showdesktop windowselector if HAVE_BATTERY SUBDIRS += battery diff --git a/applets/exit/Makefile.am b/applets/exit/Makefile.am new file mode 100644 index 0000000..4d95073 --- /dev/null +++ b/applets/exit/Makefile.am @@ -0,0 +1,13 @@ +AM_CPPFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" \ + -DGETTEXT_PACKAGE=\"matchbox-panel\" \ + $(MATCHBOX_PANEL_CFLAGS) \ + -I$(top_srcdir) -I$(top_builddir) +AM_CFLAGS = $(WARN_CFLAGS) + +appletdir = $(pkglibdir) +applet_LTLIBRARIES = libexit.la + +libexit_la_SOURCES = exit.c +libexit_la_LDFLAGS = -avoid-version + +MAINTAINERCLEANFILES = Makefile.in diff --git a/applets/exit/exit.c b/applets/exit/exit.c new file mode 100644 index 0000000..f973bb7 --- /dev/null +++ b/applets/exit/exit.c @@ -0,0 +1,35 @@ +/* + * (C) 2013 Intel Corp + * + * Author: Ross Burton <ross.burton@intel.com> + * + * Licensed under the GPL v2 or greater. + */ + +#include <config.h> +#include <gtk/gtk.h> +#include <matchbox-panel/mb-panel.h> + +static void +on_clicked (GtkButton *button, gpointer user_data) +{ + GError *error = NULL; + + if (!g_spawn_command_line_async ("matchbox-remote -exit", &error)) { + g_printerr ("Cannot ask Matchbox to exit: %s\n", error->message); + g_error_free (error); + } +} + +G_MODULE_EXPORT GtkWidget * +mb_panel_applet_create (const char *id, GtkOrientation orientation) +{ + GtkWidget *button; + + button = gtk_button_new_from_stock (GTK_STOCK_QUIT); + gtk_widget_set_name (button, "MatchboxPanelExit"); + g_signal_connect (button, "clicked", G_CALLBACK (on_clicked), NULL); + gtk_widget_show (button); + + return button; +}; diff --git a/configure.ac b/configure.ac index 48fd303..c33466e 100644 --- a/configure.ac +++ b/configure.ac @@ -91,6 +91,7 @@ matchbox-panel.pc matchbox-panel/Makefile applets/Makefile applets/clock/Makefile +applets/exit/Makefile applets/launcher/Makefile applets/notify/Makefile applets/startup/Makefile |