From: Emmanuele Bassi Date: Fri, 11 Apr 2008 15:22:34 +0000 (+0000) Subject: 2008-04-11 Emmanuele Bassi X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=817b6783c196c4758372b17dbae182697f30d048;p=clutter-gtk 2008-04-11 Emmanuele Bassi * 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. --- diff --git a/ChangeLog b/ChangeLog index 13df772..f745b24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2008-04-11 Emmanuele Bassi + + * 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 * clutter-gtk/gtk-clutter-embed.c: diff --git a/clutter-gtk/gtk-clutter-embed.c b/clutter-gtk/gtk-clutter-embed.c index 91066ae..ef2e08b 100644 --- a/clutter-gtk/gtk-clutter-embed.c +++ b/clutter-gtk/gtk-clutter-embed.c @@ -47,6 +47,7 @@ #include #include +#include #include #include "gtk-clutter-embed.h" @@ -299,8 +300,8 @@ gtk_clutter_embed_init (GtkClutterEmbed *embed) /** * 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. @@ -310,10 +311,11 @@ gtk_clutter_embed_init (GtkClutterEmbed *embed) 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); } diff --git a/clutter-gtk/gtk-clutter-embed.h b/clutter-gtk/gtk-clutter-embed.h index 19eb7f7..0735e21 100644 --- a/clutter-gtk/gtk-clutter-embed.h +++ b/clutter-gtk/gtk-clutter-embed.h @@ -41,6 +41,22 @@ 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. diff --git a/examples/gtk-clutter-events.c b/examples/gtk-clutter-events.c index 78aa952..bb2f04e 100644 --- a/examples/gtk-clutter-events.c +++ b/examples/gtk-clutter-events.c @@ -118,8 +118,8 @@ main (gint argc, gchar **argv) 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); diff --git a/examples/gtk-clutter-multistage.c b/examples/gtk-clutter-multistage.c index 3288990..292a9fc 100644 --- a/examples/gtk-clutter-multistage.c +++ b/examples/gtk-clutter-multistage.c @@ -15,8 +15,8 @@ main (int argc, char *argv[]) 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); diff --git a/examples/gtk-clutter-test.c b/examples/gtk-clutter-test.c index ecd05ad..7df3fb5 100644 --- a/examples/gtk-clutter-test.c +++ b/examples/gtk-clutter-test.c @@ -114,8 +114,8 @@ main (int argc, char *argv[]) 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);