aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2013-05-15 10:31:53 +0100
committerRoss Burton <ross.burton@intel.com>2013-07-08 18:14:48 +0100
commit4fa560ee913ed86050f2a3c99bde9bea69c87b67 (patch)
treec9ddbd83bcc2811f5aa9c9560a72e40f4b474d18
parent26a3a67b41c50e0ae163d8fe86ccf7a0f0a671ae (diff)
downloadmatchbox-panel-2-4fa560ee913ed86050f2a3c99bde9bea69c87b67.tar.gz
matchbox-panel-2-4fa560ee913ed86050f2a3c99bde9bea69c87b67.tar.bz2
matchbox-panel-2-4fa560ee913ed86050f2a3c99bde9bea69c87b67.zip
applets: add exit applet, that tells MBWM to exit
-rw-r--r--applets/Makefile.am2
-rw-r--r--applets/exit/Makefile.am13
-rw-r--r--applets/exit/exit.c35
-rw-r--r--configure.ac1
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