1 <chapter id="cha-gnome">
2 <title>Gnome integration</title>
4 GStreamer is fairly easy to integrate with Gnome applications.
5 GStreamer uses libxml 2.0, GLib 2.0 and popt, as do all other
7 There are however some basic issues you need to address in your Gnome
12 <title>Command line options</title>
14 Gnome applications call gnome_program_init () to parse command-line
15 options and initialize the necessary gnome modules.
16 GStreamer applications normally call gst_init (&argc, &argv) to
17 do the same for GStreamer.
20 Each of these two swallows the program options passed to the program,
21 so we need a different way to allow both Gnome and GStreamer to parse
22 the command-line options. This is shown in the following example.
26 /* example-begin gnome.c */
27 #include <gnome.h>
28 #include <gst/gst.h>
31 main (int argc, char **argv)
33 struct poptOption options[] = {
34 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, NULL, 0, "GStreamer", NULL },
37 GnomeProgram *program;
41 options[0].arg = (void *) gst_init_get_popt_table ();
42 if (! (program = gnome_program_init ("my_package", "0.1", LIBGNOMEUI_MODULE,
44 GNOME_PARAM_POPT_TABLE, options,
46 g_error ("gnome_program_init failed");
48 g_object_get (program, "popt-context", &context, NULL);
49 argvn = poptGetArgs (context);
51 g_print ("Run this example with some arguments to see how it works.\n");
56 g_print ("argument: %s\n", *argvn);
62 /* example-end gnome.c */
65 If you try out this program, you will see that when called with
66 --help, it will print out both GStreamer and Gnome help arguments.
67 All of the arguments that didn't belong to either end up in the
71 FIXME: flesh this out more. How do we get the GStreamer arguments
73 FIXME: add a GConf bit.