[grilo/0.1.x] grl-inspect: Add print version option



commit ca16f060284867c9519af66f3ea61a3267a559a8
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Mon Apr 16 17:53:44 2012 +0000

    grl-inspect: Add print version option
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 tools/grilo-inspect/grl-inspect.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/tools/grilo-inspect/grl-inspect.c b/tools/grilo-inspect/grl-inspect.c
index 800d05c..c3f43d7 100644
--- a/tools/grilo-inspect/grl-inspect.c
+++ b/tools/grilo-inspect/grl-inspect.c
@@ -23,6 +23,8 @@
 #include <grilo.h>
 #include <glib.h>
 
+#include "config.h"
+
 #define GRL_LOG_DOMAIN_DEFAULT grl_inspect_log_domain
 GRL_LOG_DOMAIN_STATIC(grl_inspect_log_domain);
 
@@ -31,6 +33,7 @@ static GMainLoop *mainloop = NULL;
 static gchar **introspect_sources = NULL;
 static gchar *conffile = NULL;
 static GrlPluginRegistry *registry = NULL;
+static gboolean version;
 
 static GOptionEntry entries[] = {
   { "delay", 'd', 0,
@@ -41,6 +44,10 @@ static GOptionEntry entries[] = {
     G_OPTION_ARG_STRING, &conffile,
     "Configuration file to send to sources",
     NULL },
+  { "version", 'V', 0,
+    G_OPTION_ARG_NONE, &version,
+    "Print version",
+    NULL },
   { G_OPTION_REMAINING, '\0', 0,
     G_OPTION_ARG_STRING_ARRAY, &introspect_sources,
     "Sources to introspect",
@@ -81,6 +88,14 @@ print_keys (const GList *keys)
 }
 
 static void
+print_version()
+{
+  g_print ("grl-inspect-" GRL_MAJORMINOR " version " VERSION "\n");
+  g_print ("Grilo " VERSION "\n");
+  g_print ("http://live.gnome.org/Grilo\n";);
+}
+
+static void
 introspect_source (const gchar *source_id)
 {
   GrlMediaPlugin *source;
@@ -212,6 +227,11 @@ main (int argc, char *argv[])
     return -1;
   }
 
+  if (version) {
+    print_version ();
+    return 0;
+  }
+
   grl_init (&argc, &argv);
 
   GRL_LOG_DOMAIN_INIT (grl_inspect_log_domain, "grl-inspect");



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