diff options
author | Emmanuele Bassi <ebassi@linux.intel.com> | 2011-03-18 14:57:20 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2011-03-18 14:57:20 +0000 |
commit | fc96f3db0b88454f2f2a52c0c7aa54a018c3ce28 (patch) | |
tree | 4d1229e47c52948975fc3c15957311bdbd2df57f /examples | |
parent | 149f8c29d330f8256ecf8974c6b874c76fbaeea3 (diff) | |
download | clutter-gtk-fc96f3db0b88454f2f2a52c0c7aa54a018c3ce28.tar.gz |
Make calling gtk_clutter_init* multiple times safe
Clutter-GTK should be resilient against multiple initializations, just
like Clutter and GTK+ are.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/gtk-clutter-test.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/examples/gtk-clutter-test.c b/examples/gtk-clutter-test.c index e1aefbb..2ec4c26 100644 --- a/examples/gtk-clutter-test.c +++ b/examples/gtk-clutter-test.c @@ -1,10 +1,8 @@ -#include "config.h" +#include <stdlib.h> +#include <math.h> #include <gtk/gtk.h> #include <clutter/clutter.h> -#include <math.h> - -#include <glib/gi18n.h> #include <clutter-gtk/clutter-gtk.h> @@ -121,13 +119,24 @@ main (int argc, char *argv[]) GError *error; error = NULL; - gtk_clutter_init_with_args (&argc, &argv, - NULL, - NULL, - NULL, - &error); - if (error) - g_error ("Unable to initialize: %s", error->message); + if (gtk_clutter_init_with_args (&argc, &argv, + NULL, + NULL, + NULL, + &error) != CLUTTER_INIT_SUCCESS) + { + if (error) + { + g_critical ("Unable to initialize Clutter-GTK: %s", error->message); + g_error_free (error); + return EXIT_FAILURE; + } + else + g_error ("Unable to initialize Clutter-GTK"); + } + + /* calling gtk_clutter_init* multiple times should be safe */ + g_assert (gtk_clutter_init (NULL, NULL) == CLUTTER_INIT_SUCCESS); pixbuf = gdk_pixbuf_new_from_file ("redhand.png", NULL); |