+2008-04-11 Emmanuele Bassi <ebassi@openedhand.com>
+
+ * clutter-gtk/gtk-clutter-embed.c:
+ (gtk_clutter_init): Call gtk_init_check(); this is safe, because
+ multiple calls to gtk_init() are safe.
+
+ * clutter-gtk/gtk-clutter-embed.h: Extend the ClutterInitError
+ enumeration.
+
+ * examples/gtk-clutter-events.c:
+ * examples/gtk-clutter-multistage.c:
+ * examples/gtk-clutter-test.c: Call gtk_clutter_init() and error
+ out in case of failure.
+
2008-04-04 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-gtk/gtk-clutter-embed.c:
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
+#include <gtk/gtkmain.h>
#include <clutter/clutter-x11.h>
#include "gtk-clutter-embed.h"
/**
* gtk_clutter_init:
*
- * This function should be called instead of #clutter_init() and after
- * #gtk_init()
+ * This function should be called instead of clutter_init() and
+ * gtk_init().
*
* Return value: %CLUTTER_INIT_SUCCESS on success, a negative integer
* on failure.
ClutterInitError
gtk_clutter_init (int *argc, char ***argv)
{
- clutter_x11_set_display (GDK_DISPLAY());
- clutter_x11_disable_event_retrieval ();
+ if (!gtk_init_check (argc, argv))
+ return CLUTTER_INIT_ERROR_GTK;
- /* FIXME: call gtk_init() here? */
+ clutter_x11_set_display (GDK_DISPLAY ());
+ clutter_x11_disable_event_retrieval ();
return clutter_init (argc, argv);
}
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.
ClutterColor stage_color = {255, 255, 255, 255};
ClutterColor text_color = {0, 0, 0, 255};
- gtk_init (&argc, &argv);
- gtk_clutter_init (&argc, &argv);
+ if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
+ g_error ("Unable to initialize GtkClutter");
/* Create the inital gtk window and widgets, just like normal */
widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
ClutterColor col1 = { 0xff, 0xff, 0xff, 0xff };
ClutterColor col2 = { 0, 0, 0, 0xff };
- gtk_init (&argc, &argv);
- gtk_clutter_init (&argc, &argv);
+ if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
+ g_error ("Unable to initialize GtkClutter");
pixbuf = gdk_pixbuf_new_from_file ("redhand.png", NULL);
SuperOH *oh;
gint i;
- gtk_init (&argc, &argv);
- gtk_clutter_init (&argc, &argv);
+ if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
+ g_error ("Unable to initialize GtkClutter");
pixbuf = gdk_pixbuf_new_from_file ("redhand.png", NULL);