[telepathy-stream-engine/master] Use GOption to have gtk and gst options

Olivier Crête olivier.crete at collabora.co.uk
Fri Apr 3 17:05:45 PDT 2009


---
 src/stream-engine-main.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/stream-engine-main.c b/src/stream-engine-main.c
index da27fbd..ce1be52 100644
--- a/src/stream-engine-main.c
+++ b/src/stream-engine-main.c
@@ -216,6 +216,8 @@ watchdog_bite (int sig G_GNUC_UNUSED)
 
 int main(int argc, char **argv)
 {
+  GOptionContext *optcontext;
+  GError *error = NULL;
 
 #ifdef USE_REALTIME
   if (getenv("STREAM_ENGINE_REALTIME"))
@@ -240,8 +242,19 @@ int main(int argc, char **argv)
 
 #endif
 
-  gst_init (&argc, &argv);
-  gtk_init (&argc, &argv);
+  g_thread_init (NULL);
+
+  optcontext = g_option_context_new ("Telepathy Stream Engine");
+  g_option_context_add_group (optcontext, gst_init_get_option_group ());
+  g_option_context_add_group (optcontext, gtk_get_option_group (TRUE));
+
+  if (g_option_context_parse (optcontext, &argc, &argv, &error) == FALSE) {
+    g_print ("%s\nRun '%s --help' to see a full list of available command line options.\n",
+        error->message, argv[0]);
+    return 1;
+  }
+  g_option_context_free (optcontext);
+
 
   tp_debug_divert_messages (g_getenv ("STREAM_ENGINE_LOGFILE"));
   tp_debug_set_flags (g_getenv ("STREAM_ENGINE_DEBUG"));
-- 
1.5.6.5




More information about the telepathy-commits mailing list