[grilo] Return Grilo Option group



commit e31da4b15ffa6a9a4c2581442754e30766a3fed4
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Tue Jun 15 10:18:40 2010 +0200

    Return Grilo Option group
    
    Add a function to get the GOptionGroup with generic options for Grilo.
    
    This group can be added to default application options.

 src/grilo.c |   34 +++++++++++++++++++++-------------
 src/grilo.h |    4 ++++
 2 files changed, 25 insertions(+), 13 deletions(-)
---
diff --git a/src/grilo.c b/src/grilo.c
index d74ae8b..decdc2e 100644
--- a/src/grilo.c
+++ b/src/grilo.c
@@ -29,12 +29,6 @@
 static gboolean grl_initialized = FALSE;
 static const gchar *plugin_path = NULL;
 
-static const GOptionEntry grl_args[] = {
-  { "grl-plugin-path", 0, 0, G_OPTION_ARG_STRING, &plugin_path,
-    "Colon-separated paths containing plugins", NULL },
-  { NULL }
-};
-
 void
 grl_init (gint *argc,
           gchar **argv[])
@@ -50,15 +44,9 @@ grl_init (gint *argc,
     return;
   }
 
-  /* Parse command-line options */
-  group = g_option_group_new ("grl",
-                              "Grilo Options",
-                              "Show Grilo Options",
-                              NULL,
-                              NULL);
-  g_option_group_add_entries (group, grl_args);
   ctx = g_option_context_new ("- Grilo initialization");
   g_option_context_set_ignore_unknown_options (ctx, TRUE);
+  group = grl_init_get_option_group ();
   g_option_context_add_group (ctx, group);
   g_option_context_parse (ctx, argc, argv, NULL);
   g_option_context_free (ctx);
@@ -95,3 +83,23 @@ grl_init (gint *argc,
 
   grl_initialized = TRUE;
 }
+
+GOptionGroup *
+grl_init_get_option_group (void)
+{
+  GOptionGroup *group;
+  static const GOptionEntry grl_args[] = {
+    { "grl-plugin-path", 0, 0, G_OPTION_ARG_STRING, &plugin_path,
+      "Colon-separated paths containing plugins", NULL },
+    { NULL }
+  };
+
+  group = g_option_group_new ("grl",
+                              "Grilo Options:",
+                              "Show Grilo Options",
+                              NULL,
+                              NULL);
+  g_option_group_add_entries (group, grl_args);
+
+  return group;
+}
diff --git a/src/grilo.h b/src/grilo.h
index ca4c358..5991197 100644
--- a/src/grilo.h
+++ b/src/grilo.h
@@ -31,6 +31,8 @@
 # endif
 #endif
 
+#include <glib.h>
+
 #include <grl-error.h>
 #include <grl-log.h>
 #include <grl-plugin-registry.h>
@@ -53,6 +55,8 @@ G_BEGIN_DECLS
 
 void grl_init (gint *argc, gchar **argv[]);
 
+GOptionGroup *grl_init_get_option_group (void);
+
 G_END_DECLS
 
 #endif /* _GRILO_H_ */



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