Move init functions out of Embed source
authorEmmanuele Bassi <ebassi@linux.intel.com>
Tue, 14 Apr 2009 13:52:34 +0000 (14:52 +0100)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Tue, 14 Apr 2009 13:52:34 +0000 (14:52 +0100)
The gtk_clutter_init* family of functions should live in the
utilities code, and not inside the GtkClutterEmbed header and
source files.

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

index 341de72..c40caf1 100644 (file)
@@ -522,91 +522,6 @@ gtk_clutter_embed_init (GtkClutterEmbed *embed)
 }
 
 /**
- * gtk_clutter_init:
- * @argc: pointer to the arguments count, or %NULL
- * @argv: pointer to the arguments vector, or %NULL
- *
- * This function should be called instead of clutter_init() and
- * gtk_init().
- *
- * Return value: %CLUTTER_INIT_SUCCESS on success, a negative integer
- *   on failure.
- *
- * Since: 0.8
- */
-ClutterInitError
-gtk_clutter_init (int    *argc,
-                  char ***argv)
-{
-  if (!gtk_init_check (argc, argv))
-    return CLUTTER_INIT_ERROR_GTK;
-
-#if defined(HAVE_CLUTTER_GTK_X11)
-  clutter_x11_set_display (GDK_DISPLAY());
-  clutter_x11_disable_event_retrieval ();
-#elif defined(HAVE_CLUTTER_GTK_WIN32)
-  clutter_win32_disable_event_retrieval ();
-#endif /* HAVE_CLUTTER_GTK_{X11,WIN32} */
-
-  return clutter_init (argc, argv);
-}
-
-/**
- * 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 9a6e5b3..eda509c 100644 (file)
@@ -44,22 +44,6 @@ typedef struct _GtkClutterEmbedPrivate  GtkClutterEmbedPrivate;
 typedef struct _GtkClutterEmbedClass    GtkClutterEmbedClass;
 
 /**
- * ClutterGtkInitError:
- * @CLUTTER_INIT_ERROR_LAST: Placeholder
- * @CLUTTER_INIT_ERROR_GTK: Unable to initialize GTK+
- *
- * Extension of the #ClutterInitError enumeration for the integration
- * with GTK+
- *
- * Since: 0.8
- */
-typedef enum {
-  CLUTTER_INIT_ERROR_LAST = CLUTTER_INIT_ERROR_INTERNAL,
-
-  CLUTTER_INIT_ERROR_GTK  = (CLUTTER_INIT_ERROR_LAST - 1)
-} ClutterGtkInitError;
-
-/**
  * GtkClutterEmbed:
  *
  * A #GtkWidget containing the default Clutter stage.
@@ -99,15 +83,6 @@ GType         gtk_clutter_embed_get_type  (void) G_GNUC_CONST;
 GtkWidget *   gtk_clutter_embed_new       (void);
 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
 
 #endif /* __GTK_CLUTTER_EMBED_H__ */
index 6b61ebd..ac52727 100644 (file)
@@ -2,11 +2,24 @@
 #include "config.h"
 #endif
 
+#include "gtk-clutter-util.h"
+
 #include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gdk/gdk.h>
 #include <gtk/gtk.h>
 #include <clutter/clutter.h>
 
-#include "gtk-clutter-util.h"
+#if defined(HAVE_CLUTTER_GTK_X11)
+
+#include <clutter/x11/clutter-x11.h>
+#include <gdk/gdkx.h>
+
+#elif defined(HAVE_CLUTTER_GTK_WIN32)
+
+#include <clutter/clutter-win32.h>
+#include <gdk/gdkwin32.h>
+
+#endif /* HAVE_CLUTTER_GTK_{X11,WIN32} */
 
 /**
  * SECTION:gtk-clutter-util
@@ -579,3 +592,88 @@ gtk_clutter_texture_set_from_icon_name (ClutterTexture *texture,
   gtk_clutter_texture_set_from_pixbuf (texture, pixbuf);
   g_object_unref (pixbuf);
 }
+
+/**
+ * gtk_clutter_init:
+ * @argc: pointer to the arguments count, or %NULL
+ * @argv: pointer to the arguments vector, or %NULL
+ *
+ * This function should be called instead of clutter_init() and
+ * gtk_init().
+ *
+ * Return value: %CLUTTER_INIT_SUCCESS on success, a negative integer
+ *   on failure.
+ *
+ * Since: 0.8
+ */
+ClutterInitError
+gtk_clutter_init (int    *argc,
+                  char ***argv)
+{
+  if (!gtk_init_check (argc, argv))
+    return CLUTTER_INIT_ERROR_GTK;
+
+#if defined(HAVE_CLUTTER_GTK_X11)
+  clutter_x11_set_display (GDK_DISPLAY());
+  clutter_x11_disable_event_retrieval ();
+#elif defined(HAVE_CLUTTER_GTK_WIN32)
+  clutter_win32_disable_event_retrieval ();
+#endif /* HAVE_CLUTTER_GTK_{X11,WIN32} */
+
+  return clutter_init (argc, argv);
+}
+
+/**
+ * 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);
+}
index 8d60c90..c228a01 100644 (file)
 
 G_BEGIN_DECLS
 
+/**
+ * ClutterGtkInitError:
+ * @CLUTTER_INIT_ERROR_LAST: Placeholder
+ * @CLUTTER_INIT_ERROR_GTK: Unable to initialize GTK+
+ *
+ * Extension of the #ClutterInitError enumeration for the integration
+ * with GTK+
+ *
+ * Since: 0.8
+ */
+typedef enum {
+  CLUTTER_INIT_ERROR_LAST = CLUTTER_INIT_ERROR_INTERNAL,
+
+  CLUTTER_INIT_ERROR_GTK  = (CLUTTER_INIT_ERROR_LAST - 1)
+} ClutterGtkInitError;
+
+ClutterInitError gtk_clutter_init           (int            *argc,
+                                             char         ***argv);
+ClutterInitError gtk_clutter_init_with_args (int            *argc,
+                                             char         ***argv,
+                                             const char     *parameter_string,
+                                             GOptionEntry   *entries,
+                                             const char     *translation_domain,
+                                             GError        **error);
+
 void          gtk_clutter_get_fg_color               (GtkWidget      *widget,
                                                       GtkStateType    state,
                                                       ClutterColor   *color);