[gnome-panel/wip/segeiger/version] Options: Add a '--version' option



commit 2bfb9dd4bb0fbf28499a8370c1439b2f092f3842
Author: Sebastian Geiger <sbastig gmx net>
Date:   Fri Aug 21 11:27:15 2015 +0200

    Options: Add a '--version' option
    
    When gnome-panel is started with the --version option it prints
    the current version and some additional information such as the URL for bug reports
    and a disclaimer and exits.

 gnome-panel/main.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gnome-panel/main.c b/gnome-panel/main.c
index 4cbf604..cf34a46 100644
--- a/gnome-panel/main.c
+++ b/gnome-panel/main.c
@@ -30,10 +30,12 @@ GSList *panels = NULL;
 GSList *panel_list = NULL;
 
 static gboolean  replace = FALSE;
+static gboolean  version = FALSE;
 static GtkCssProvider *provider = NULL;
 
 static const GOptionEntry options[] = {
   { "replace", 0, 0, G_OPTION_ARG_NONE, &replace, N_("Replace a currently running panel"), NULL },
+  { "version", 0, 0, G_OPTION_ARG_NONE, &version, N_("Print gnome version and exit"), NULL},
   { NULL }
 };
 
@@ -128,6 +130,17 @@ main (int argc, char **argv)
 
        g_option_context_free (context);
 
+       if (version) {
+               printf("%s\n", PACKAGE " " VERSION);
+               printf("\n");
+               printf("Bug Reports: %s\n", PACKAGE_BUGREPORT);
+               printf("\n");
+               printf("This program comes with ABSOLUTELY NO WARRANTY.\n"
+                                        "This is free software, and you are welcome to redistribute it\n"
+                                        "under certain conditions. See the file COPYING for details.\n");
+               return EXIT_SUCCESS;
+       }
+
        session = panel_session_new (replace);
        if (session == NULL)
                return 1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]