]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/commitdiff
tools: call g_set_prgname() before doing the option parsing
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Tue, 16 Feb 2010 11:30:35 +0000 (11:30 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Tue, 16 Feb 2010 11:33:19 +0000 (11:33 +0000)
g_setprgname is implicitly called by g_option_context_new() with a check
to see if it's been set already, so set it before g_option_context_new()

Move version printing back until after the options have been parsed,
otherwise it won't work, since it evaluates a flag set by the
option parser.

tools/gst-inspect.c
tools/gst-launch.c
tools/gst-typefind.c
tools/gst-xmlinspect.c
tools/tools.h

index 13d76da5d4a89a5208ce1e8d10e0e7208c321726..4f2723d1529a875a7ceddcfc42ff86c1b24c9291 100644 (file)
@@ -1491,6 +1491,8 @@ main (int argc, char *argv[])
 
   g_thread_init (NULL);
 
+  gst_tools_set_prgname ("gst-inspect");
+
 #ifndef GST_DISABLE_OPTION_PARSING
   ctx = g_option_context_new ("[ELEMENT-NAME | PLUGIN-NAME]");
   g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
index 591d631101d88e55c80f281eed193a31c0b3abc8..cb9b8e2f2e13b1c1f933f2eb231cd380a3893936 100644 (file)
@@ -715,6 +715,8 @@ main (int argc, char *argv[])
 
   g_thread_init (NULL);
 
+  gst_tools_set_prgname ("gst-launch");
+
 #ifndef GST_DISABLE_OPTION_PARSING
   ctx = g_option_context_new ("PIPELINE-DESCRIPTION");
   g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
index d51f282496710ee76af3f634503f37e6673e693b..53635d620e6aed65d092957d58a8d6e80a6af0e7 100644 (file)
@@ -155,7 +155,7 @@ main (int argc, char *argv[])
 
   g_thread_init (NULL);
 
-  gst_tools_print_version ("gst-typefind");
+  gst_tools_set_prgname ("gst-typefind");
 
   ctx = g_option_context_new ("FILES");
   g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
@@ -166,6 +166,8 @@ main (int argc, char *argv[])
   }
   g_option_context_free (ctx);
 
+  gst_tools_print_version ("gst-typefind");
+
   if (filenames == NULL || *filenames == NULL) {
     g_print ("Please give a filename to typefind\n\n");
     return 1;
index 6a8b6fdce8ba56477d23418472de4edf91fc38b7..4e608071ffb0ff316bbb628c84f2d7c44fbde203 100644 (file)
@@ -639,7 +639,7 @@ main (int argc, char *argv[])
 
   g_thread_init (NULL);
 
-  gst_tools_print_version ("gst-xmlinspect");
+  gst_tools_set_prgname ("gst-xmlinspect");
 
   ctx = g_option_context_new ("[ELEMENT-NAME]");
   g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
@@ -650,6 +650,8 @@ main (int argc, char *argv[])
   }
   g_option_context_free (ctx);
 
+  gst_tools_print_version ("gst-xmlinspect");
+
   /* if no arguments, print out all elements */
   if (argc == 1) {
     GList *features, *f;
index a4e3371eded118fa5f9757e9c72f9088026e23bc..93ac542eebbf44687b3b6496bbe5ea50a1ec3467 100644 (file)
@@ -44,12 +44,6 @@ static gboolean __gst_tools_version = FALSE;
 static void
 gst_tools_print_version (const gchar * tool)
 {
-  gchar *s;
-
-  s = g_strdup_printf ("%s-%u.%u", tool, GST_VERSION_MAJOR, GST_VERSION_MINOR);
-  g_set_prgname (s);
-  g_free (s);
-
   if (__gst_tools_version) {
     gchar *version_str;
 
@@ -63,4 +57,14 @@ gst_tools_print_version (const gchar * tool)
   }
 }
 
+static void
+gst_tools_set_prgname (const gchar * tool)
+{
+  gchar *s;
+
+  s = g_strdup_printf ("%s-%u.%u", tool, GST_VERSION_MAJOR, GST_VERSION_MINOR);
+  g_set_prgname (s);
+  g_free (s);
+}
+
 #endif /* __GST_TOOLS_H__ */