[gnome-system-monitor] Added command line option to show application version. https://bugzilla.gnome.org/show_bug.cgi?id=69



commit 232ad3ee8c91855a7cb1a7b36073394760682bed
Author: Robert Roth <robert roth off gmail com>
Date:   Thu Apr 25 23:49:06 2013 +0300

    Added command line option to show application version.
    https://bugzilla.gnome.org/show_bug.cgi?id=698875

 src/argv.cpp        |    8 +++++++-
 src/argv.h          |    1 +
 src/procman-app.cpp |    8 ++++++--
 3 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/argv.cpp b/src/argv.cpp
index 5f07268..6326d65 100644
--- a/src/argv.cpp
+++ b/src/argv.cpp
@@ -12,7 +12,8 @@ namespace procman
         : Glib::OptionGroup("", ""),
           show_processes_tab(false),
           show_resources_tab(false),
-          show_file_systems_tab(false)
+          show_file_systems_tab(false),
+          print_version(false)
     {
         Glib::OptionEntry proc_tab;
         proc_tab.set_long_name("show-processes-tab");
@@ -29,9 +30,14 @@ namespace procman
         fs_tab.set_short_name('f');
         fs_tab.set_description(_("Show the File Systems tab"));
 
+       Glib::OptionEntry show_version;
+        show_version.set_long_name("version");
+        show_version.set_description(_("Show the application's version"));
+
         this->add_entry(proc_tab, this->show_processes_tab);
         this->add_entry(res_tab, this->show_resources_tab);
         this->add_entry(fs_tab, this->show_file_systems_tab);
+        this->add_entry(show_version, this->print_version);
     }
 }
 
diff --git a/src/argv.h b/src/argv.h
index 8d8ff21..6c7519b 100644
--- a/src/argv.h
+++ b/src/argv.h
@@ -15,6 +15,7 @@ namespace procman
         bool show_processes_tab;
         bool show_resources_tab;
         bool show_file_systems_tab;
+        bool print_version;
     };
 }
 
diff --git a/src/procman-app.cpp b/src/procman-app.cpp
index 6ce08b9..f526ad3 100644
--- a/src/procman-app.cpp
+++ b/src/procman-app.cpp
@@ -584,6 +584,8 @@ int ProcmanApp::on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine>&
         g_error("Arguments parse error : %s", ex.what().c_str());
     }
 
+    g_strfreev(argv);
+
     if (option_group.show_processes_tab) {
         procman_debug("Starting with PROCMAN_TAB_PROCESSES by commandline request");
         set_tab(GTK_NOTEBOOK(notebook), PROCMAN_TAB_PROCESSES, this);
@@ -593,12 +595,14 @@ int ProcmanApp::on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine>&
     } else if (option_group.show_file_systems_tab) {
         procman_debug("Starting with PROCMAN_TAB_DISKS by commandline request");
         set_tab(GTK_NOTEBOOK(notebook), PROCMAN_TAB_DISKS, this);
+    } else if (option_group.print_version) {
+        g_print("%s %s\n", _("GNOME Image Viewer"), VERSION);
+       exit (EXIT_SUCCESS);
+       return 0;
     }
 
     on_activate ();
 
-    g_strfreev(argv);
-
     return 0;
 }
 


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