gnome-games r8187 - trunk/aisleriot



Author: chpe
Date: Thu Oct 23 17:17:21 2008
New Revision: 8187
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8187&view=rev

Log:
Use the clutter option group instead of calling gtk_clutter_init()
directly.

Modified:
   trunk/aisleriot/clutter-embed.c
   trunk/aisleriot/clutter-embed.h
   trunk/aisleriot/sol.c

Modified: trunk/aisleriot/clutter-embed.c
==============================================================================
--- trunk/aisleriot/clutter-embed.c	(original)
+++ trunk/aisleriot/clutter-embed.c	Thu Oct 23 17:17:21 2008
@@ -454,6 +454,27 @@
   return clutter_init (argc, argv);
 }
 
+ClutterInitError
+aisleriot_clutter_init_with_args (int            *argc,
+                            char         ***argv,
+                            const char     *parameter_string,
+                            GOptionEntry   *entries,
+                            const char     *translation_domain,
+                            GError        **error)
+{
+  if (!gtk_init_with_args (argc, argv, (char*) parameter_string, entries, (char*) translation_domain, error))
+    return AISLERIOT_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);
+}
+
 /**
  * aisleriot_clutter_embed_new:
  *

Modified: trunk/aisleriot/clutter-embed.h
==============================================================================
--- trunk/aisleriot/clutter-embed.h	(original)
+++ trunk/aisleriot/clutter-embed.h	Thu Oct 23 17:17:21 2008
@@ -97,7 +97,12 @@
 
 ClutterInitError aisleriot_clutter_init (gint    *argc,
                                    gchar ***argv);
-
+ClutterInitError aisleriot_clutter_init_with_args (int          *argc,
+                                             char       ***argv,
+                                             const char   *parameter_string,
+                                             GOptionEntry *entries,
+                                             const char   *translation_domain,
+                                             GError      **error);
 G_END_DECLS
 
 #endif /* __AISLERIOT_CLUTTER_EMBED_H__ */

Modified: trunk/aisleriot/sol.c
==============================================================================
--- trunk/aisleriot/sol.c	(original)
+++ trunk/aisleriot/sol.c	Thu Oct 23 17:17:21 2008
@@ -76,6 +76,7 @@
 #include "game.h"
 #include "util.h"
 #include "window.h"
+#include "clutter-embed.h"
 
 typedef struct {
   AisleriotWindow *window;
@@ -541,24 +542,31 @@
   games_sound_enable (FALSE);
   games_sound_add_option_group (option_context);
 
-#ifdef HAVE_CLUTTER
-  /* FIXMEchpe: use option group instead */
-  gtk_clutter_init (&argc, &argv);
-#endif
-
   g_option_context_add_group (option_context, gtk_get_option_group (TRUE));
 #ifdef WITH_SMCLIENT
   g_option_context_add_group (option_context, egg_sm_client_get_option_group ());
 #endif /* WITH_SMCLIENT */
+#ifdef HAVE_CLUTTER
+  g_option_context_add_group (option_context, clutter_get_option_group_without_init ());
+#endif
 
   retval = g_option_context_parse (option_context, &argc, &argv, &error);
   g_option_context_free (option_context);
 
   if (!retval) {
-    g_print ("%s\n", error->message);
+    g_printerr ("%s\n", error->message);
+    g_error_free (error);
     goto cleanup;
   }
 
+#ifdef HAVE_CLUTTER
+  if (aisleriot_clutter_init_with_args (NULL, NULL, NULL, NULL, NULL, &error) != CLUTTER_INIT_SUCCESS) {
+    g_printerr ("Failed to initialise clutter: %s\n", error->message);
+    g_error_free (error);
+    goto cleanup;
+  }
+#endif
+
 #ifdef HAVE_MAEMO
   data.program = HILDON_PROGRAM (hildon_program_get_instance ());
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]