Add gtk_clutter_init_with_args()
authorChristian Persch <chpe@gnome.org>
Mon, 30 Mar 2009 18:27:48 +0000 (20:27 +0200)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Tue, 14 Apr 2009 13:25:26 +0000 (14:25 +0100)
This function allows calling gtk_init_with_args() and
clutter_init_with_args(), supplying the command line entries,
a translation domain and getting a run-time error back.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>

clutter-gtk/gtk-clutter-embed.c
clutter-gtk/gtk-clutter-embed.h

index cbeeb86..341de72 100644 (file)
@@ -552,6 +552,61 @@ gtk_clutter_init (int    *argc,
 }
 
 /**
+ * gtk_clutter_init_with_args:
+ * @argc: a pointer to the number of command line arguments.
+ * @argv: a pointer to the array of command line arguments.
+ * @parameter_string: a string which is displayed in
+ *    the first line of <option>--help</option> output, after
+ *    <literal><replaceable>programname</replaceable> [OPTION...]</literal>
+ * @entries: a %NULL-terminated array of #GOptionEntry<!-- -->s
+ *    describing the options of your program
+ * @translation_domain: a translation domain to use for translating
+ *    the <option>--help</option> output for the options in @entries
+ *    with gettext(), or %NULL
+ * @error: a return location for errors
+ *
+ * This function should be called instead of clutter_init() and
+ * gtk_init_with_args().
+ *
+ * Return value: %CLUTTER_INIT_SUCCESS on success, a negative integer
+ *   on failure.
+ *
+ * Since: 1.0
+ */
+ClutterInitError
+gtk_clutter_init_with_args (int            *argc,
+                            char         ***argv,
+                            const char     *parameter_string,
+                            GOptionEntry   *entries,
+                            const char     *translation_domain,
+                            GError        **error)
+{
+  gboolean res;
+
+  res = gtk_init_with_args (argc, argv,
+                            (char*) parameter_string,
+                            entries,
+                            (char*) translation_domain,
+                            error);
+
+  if (!res)
+    return CLUTTER_INIT_ERROR_GTK;
+
+#if defined(GDK_WINDOWING_X11)
+  clutter_x11_set_display (GDK_DISPLAY());
+  clutter_x11_disable_event_retrieval ();
+#elif defined(GDK_WINDOWING_WIN32)
+  clutter_win32_disable_event_retrieval ();
+#endif /* GDK_WINDOWING_{X11,WIN32} */
+
+  return clutter_init_with_args (argc, argv,
+                                 NULL,
+                                 NULL,
+                                 NULL,
+                                 error);
+}
+
+/**
  * gtk_clutter_embed_new:
  *
  * Creates a new #GtkClutterEmbed widget. This widget can be
index 52dd00d..9a6e5b3 100644 (file)
@@ -101,6 +101,12 @@ ClutterActor *gtk_clutter_embed_get_stage (GtkClutterEmbed *embed);
 
 ClutterInitError gtk_clutter_init (gint    *argc,
                                    gchar ***argv);
+ClutterInitError gtk_clutter_init_with_args (int          *argc,
+                                             char       ***argv,
+                                             const char   *parameter_string,
+                                             GOptionEntry *entries,
+                                             const char   *translation_domain,
+                                             GError      **error);
 
 G_END_DECLS