[Pkg-wmaker-commits] [wmshutdown] 117/173: wmshutdown.c: Add command line options (--help and --version).

Doug Torrance dtorrance-guest at moszumanska.debian.org
Tue Aug 25 02:46:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmshutdown.

commit f6234575c562a95ab75b46370d881be2d07934d0
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Thu Aug 7 01:29:26 2014 -0500

    wmshutdown.c: Add command line options (--help and --version).
---
 configure.ac |  1 +
 wmshutdown.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/configure.ac b/configure.ac
index 3fcf82a..d41bc77 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,7 @@
 AC_INIT([wmshutdown], [1.0], [dtorrance at monmouthcollege.edu])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 AC_CONFIG_SRCDIR([configure.ac])
+AC_CONFIG_HEADER([config.h])
 AC_PROG_CC
 PKG_CHECK_MODULES([gtk],[gtk+-3.0])
 PKG_CHECK_MODULES([x11],[x11])
diff --git a/wmshutdown.c b/wmshutdown.c
index 81e5e16..90d251a 100644
--- a/wmshutdown.c
+++ b/wmshutdown.c
@@ -20,8 +20,21 @@
 #include <gdk/gdkx.h>
 #include <gio/gio.h>
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+static int showVersion = 0;
 GtkWidget *dialog = NULL;
 
+static GOptionEntry entries[] =
+{
+	{ "version", 'v', 0, G_OPTION_ARG_NONE, &showVersion,
+	  "Display version information", NULL },
+	{ NULL }
+};
+
+
 /* gtk3 dockapp code based on wmpasman by Brad Jorsch
  * <anomie at users.sourceforge.net>
  * http://sourceforge.net/projects/wmpasman */
@@ -152,12 +165,28 @@ void button_press(GtkWidget *widget, GdkEvent *event) {
 }
 
 int main(int argc, char *argv[]) {
+	GError *error = NULL;
+	GOptionContext *context;
 	GtkWidget *gtkiw;
 	GtkWidget *dockArea;
 	GtkWidget *pixmap;
 
+
 	gtk_init(&argc, &argv);
 
+
+	context = g_option_context_new ("- dockapp to shutdown or reboot your "
+					"machine");
+	g_option_context_add_main_entries (context, entries, NULL);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	g_option_context_parse (context, &argc, &argv, &error);
+
+	if (showVersion) {
+		printf("wmforecast "VERSION"\n");
+		return 0;
+	}
+
+
 	gtkiw = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 	dockArea = cria_dock(gtkiw, 47);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmshutdown.git



More information about the Pkg-wmaker-commits mailing list