[gnome-games] aisleriot: Use games-glib-compat.h



commit a1bef05b22ab190278544fd4ba502f3b89567261
Author: Christian Persch <chpe gnome org>
Date:   Mon Jan 4 19:53:33 2010 +0100

    aisleriot: Use games-glib-compat.h

 aisleriot/ar-fullscreen-button.c     |    1 +
 aisleriot/ar-game-chooser.c          |    1 +
 aisleriot/ar-style-gtk.c             |    1 +
 aisleriot/ar-style.c                 |    1 +
 aisleriot/board-noclutter.c          |   13 ++++------
 aisleriot/board.c                    |    1 +
 aisleriot/card.c                     |    2 +
 aisleriot/game.c                     |   44 +++++++++++----------------------
 aisleriot/slot-renderer.c            |    2 +
 aisleriot/window.c                   |   15 +----------
 libgames-support/games-glib-compat.h |    2 +
 11 files changed, 32 insertions(+), 51 deletions(-)
---
diff --git a/aisleriot/ar-fullscreen-button.c b/aisleriot/ar-fullscreen-button.c
index 28216ca..05e47c4 100644
--- a/aisleriot/ar-fullscreen-button.c
+++ b/aisleriot/ar-fullscreen-button.c
@@ -20,6 +20,7 @@
 #include "ar-fullscreen-button.h"
 
 #include <libgames-support/games-stock.h>
+#include <libgames-support/games-glib-compat.h>
 
 struct _ArFullscreenButtonPrivate {
   GtkWindow *window;
diff --git a/aisleriot/ar-game-chooser.c b/aisleriot/ar-game-chooser.c
index 2dda782..c6c837e 100644
--- a/aisleriot/ar-game-chooser.c
+++ b/aisleriot/ar-game-chooser.c
@@ -26,6 +26,7 @@
 #include <libgames-support/games-debug.h>
 #include <libgames-support/games-runtime.h>
 #include <libgames-support/games-string-utils.h>
+#include <libgames-support/games-glib-compat.h>
 
 #ifdef HAVE_MAEMO_5
 #include <hildon/hildon-gtk.h>
diff --git a/aisleriot/ar-style-gtk.c b/aisleriot/ar-style-gtk.c
index 10f9dc7..edfe917 100644
--- a/aisleriot/ar-style-gtk.c
+++ b/aisleriot/ar-style-gtk.c
@@ -23,6 +23,7 @@
 #include "ar-style-private.h"
 
 #include <libgames-support/games-debug.h>
+#include <libgames-support/games-glib-compat.h>
 
 /**
  * SECTION: ar-style-gtk
diff --git a/aisleriot/ar-style.c b/aisleriot/ar-style.c
index cc0cf24..bbc2941 100644
--- a/aisleriot/ar-style.c
+++ b/aisleriot/ar-style.c
@@ -21,6 +21,7 @@
 #include "ar-style-private.h"
 
 #include <libgames-support/games-debug.h>
+#include <libgames-support/games-glib-compat.h>
 
 enum
 {
diff --git a/aisleriot/board-noclutter.c b/aisleriot/board-noclutter.c
index 8ddffb5..7d774f1 100644
--- a/aisleriot/board-noclutter.c
+++ b/aisleriot/board-noclutter.c
@@ -28,6 +28,7 @@
 
 #include <libgames-support/games-card-images.h>
 #include <libgames-support/games-files.h>
+#include <libgames-support/games-glib-compat.h>
 #include <libgames-support/games-gtk-compat.h>
 #include <libgames-support/games-marshal.h>
 #include <libgames-support/games-pixbuf-utils.h>
@@ -69,11 +70,7 @@
 #define PIXBUF_DRAWING_LIKELIHOOD(cond) (cond)
 #endif /* HAVE_HILDON */
 
-#if GLIB_CHECK_VERSION (2, 10, 0)
 #define I_(string) g_intern_static_string (string)
-#else
-#define I_(string) string
-#endif
 
 typedef enum {
   STATUS_NONE,
@@ -3451,7 +3448,9 @@ aisleriot_board_class_init (AisleriotBoardClass *klass)
      PROP_GAME,
      g_param_spec_object ("game", NULL, NULL,
                           AISLERIOT_TYPE_GAME,
-                          G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_CONSTRUCT_ONLY));
+                          G_PARAM_WRITABLE |
+                          G_PARAM_CONSTRUCT_ONLY |
+                          G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property
     (gobject_class,
@@ -3460,9 +3459,7 @@ aisleriot_board_class_init (AisleriotBoardClass *klass)
                           AR_TYPE_STYLE,
                           G_PARAM_WRITABLE |
                           G_PARAM_CONSTRUCT_ONLY |
-                          G_PARAM_STATIC_NAME |
-                          G_PARAM_STATIC_NICK |
-                          G_PARAM_STATIC_BLURB));
+                          G_PARAM_STATIC_STRINGS));
 
   _ar_style_gtk_class_install_style_properties (widget_class);
 
diff --git a/aisleriot/board.c b/aisleriot/board.c
index 4695a9c..029002e 100644
--- a/aisleriot/board.c
+++ b/aisleriot/board.c
@@ -31,6 +31,7 @@
 #include <libgames-support/games-card-textures-cache.h>
 #include <libgames-support/games-debug.h>
 #include <libgames-support/games-files.h>
+#include <libgames-support/games-glib-compat.h>
 #include <libgames-support/games-marshal.h>
 #include <libgames-support/games-pixbuf-utils.h>
 #include <libgames-support/games-sound.h>
diff --git a/aisleriot/card.c b/aisleriot/card.c
index 0a56fe4..393c4e4 100644
--- a/aisleriot/card.c
+++ b/aisleriot/card.c
@@ -23,6 +23,8 @@
 
 #include "card.h"
 
+#include <libgames-support/games-glib-compat.h>
+
 static void aisleriot_card_paint (ClutterActor *actor);
 
 static void aisleriot_card_get_preferred_width (ClutterActor *self,
diff --git a/aisleriot/game.c b/aisleriot/game.c
index c48ac7b..c141750 100644
--- a/aisleriot/game.c
+++ b/aisleriot/game.c
@@ -36,6 +36,7 @@
 #endif
 
 #include <libgames-support/games-debug.h>
+#include <libgames-support/games-glib-compat.h>
 #include <libgames-support/games-runtime.h>
 #include <libgames-support/games-string-utils.h>
 
@@ -46,11 +47,7 @@
 
 #define DELAYED_CALLBACK_DELAY (50)
 
-#if GLIB_CHECK_VERSION (2, 10, 0)
 #define I_(string) g_intern_static_string (string)
-#else
-#define I_(string) string
-#endif
 
 struct _AisleriotGame
 {
@@ -251,11 +248,7 @@ clear_slots (AisleriotGame *game,
 #endif /* HAVE_CLUTTER */
     g_byte_array_free (slot->cards, TRUE);
 
-#if GLIB_CHECK_VERSION (2, 10, 0)
     g_slice_free (ArSlot, slot);
-#else
-    g_free (slot);
-#endif
   }
 
   g_ptr_array_set_size (game->slots, 0);
@@ -630,11 +623,7 @@ cscmi_add_slot (SCM slot_data)
 #endif /* GNOME_ENABLE_DEBUG */
 
   /* create and initialize slot */
-#if GLIB_CHECK_VERSION (2, 10, 0)
   slot = g_slice_new0 (ArSlot);
-#else
-  slot = g_new0 (Slot, 1);
-#endif
 
   g_ptr_array_add (game->slots, slot);
 
@@ -1341,42 +1330,48 @@ aisleriot_game_class_init (AisleriotGameClass *klass)
      PROP_CAN_UNDO,
      g_param_spec_boolean ("can-undo", NULL, NULL,
                            FALSE,
-                           G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+                           G_PARAM_READABLE |
+                           G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property
     (gobject_class,
      PROP_CAN_REDO,
      g_param_spec_boolean ("can-redo", NULL, NULL,
                            FALSE,
-                           G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+                           G_PARAM_READABLE |
+                           G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property
     (gobject_class,
      PROP_CAN_DEAL,
      g_param_spec_boolean ("can-deal", NULL, NULL,
                            FALSE,
-                           G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+                           G_PARAM_READABLE |
+                           G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property
     (gobject_class,
      PROP_GAME_FILE,
      g_param_spec_string ("game-file", NULL, NULL,
                           NULL,
-                          G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+                          G_PARAM_READABLE |
+                          G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property
     (gobject_class,
      PROP_SCORE,
-     g_param_spec_uint ("score", "", "",
+     g_param_spec_uint ("score", NULL, NULL,
                         0, G_MAXUINT, 0,
-                        G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+                        G_PARAM_READABLE |
+                        G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property
     (gobject_class,
      PROP_STATE,
-     g_param_spec_uint ("state", "", "",
+     g_param_spec_uint ("state", NULL, NULL,
                         0, LAST_GAME_STATE, 0, 
-                        G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+                        G_PARAM_READABLE |
+                        G_PARAM_STATIC_STRINGS));
 
   /* Initialise our scheme interfaces */
   cscm_init ();
@@ -2084,11 +2079,7 @@ aisleriot_game_option_free (AisleriotGameOption *option)
   g_return_if_fail (option != NULL);
 
   g_free (option->display_name);
-#if GLIB_CHECK_VERSION (2, 10, 0)
   g_slice_free (AisleriotGameOption, option);
-#else
-  g_free (option);
-#endif
 }
 
 /**
@@ -2145,12 +2136,7 @@ aisleriot_game_get_options (AisleriotGame *game)
 
       entrystate = SCM_NFALSEP (scm_list_ref (entry, scm_from_uint (1)));
 
-#if GLIB_CHECK_VERSION (2, 10, 0)
       option = g_slice_new (AisleriotGameOption);
-#else
-      option = g_new (AisleriotGameOption, 1);
-#endif
-
       option->display_name = g_strdup (entrynamestr);
       option->type = type;
       option->value = bit;
diff --git a/aisleriot/slot-renderer.c b/aisleriot/slot-renderer.c
index ff91067..879b627 100644
--- a/aisleriot/slot-renderer.c
+++ b/aisleriot/slot-renderer.c
@@ -26,6 +26,8 @@
 #include "slot-renderer.h"
 #include "card.h"
 
+#include <libgames-support/games-glib-compat.h>
+
 static void aisleriot_slot_renderer_dispose (GObject *object);
 static void aisleriot_slot_renderer_finalize (GObject *object);
 
diff --git a/aisleriot/window.c b/aisleriot/window.c
index 9d2e66c..7224bb1 100644
--- a/aisleriot/window.c
+++ b/aisleriot/window.c
@@ -41,6 +41,7 @@
 #include <libgames-support/games-card-themes.h>
 #include <libgames-support/games-clock.h>
 #include <libgames-support/games-debug.h>
+#include <libgames-support/games-glib-compat.h>
 #include <libgames-support/games-stock.h>
 #include <libgames-support/games-runtime.h>
 #include <libgames-support/games-sound.h>
@@ -624,12 +625,7 @@ static void
 delayed_move_to_next_screen_cb (GtkAction *action,
                                 GtkWidget *widget)
 {
-#if GLIB_CHECK_VERSION (2, 14, 0)
   g_timeout_add_seconds (10, (GSourceFunc) delayed_move_to_next_screen_timeout_cb, widget);
-#else
-  g_timeout_add (10 * 1000, (GSourceFunc) delayed_move_to_next_screen_timeout_cb, widget);
-#endif /* GLIB 2.14.0 */
-
 }
 
 static void
@@ -3014,11 +3010,7 @@ free_load_idle_data (LoadIdleData *data)
   data->window->priv->load_idle_id = 0;
 
   g_free (data->game_file);
-#if GLIB_CHECK_VERSION (2, 10, 0)
   g_slice_free (LoadIdleData, data);
-#else
-  g_free (data);
-#endif
 }
 
 /**
@@ -3044,12 +3036,7 @@ aisleriot_window_set_game (AisleriotWindow *window,
     g_source_remove (priv->load_idle_id);
   }
 
-#if GLIB_CHECK_VERSION (2, 10, 0)
   data = g_slice_new (LoadIdleData);
-#else
-  data = g_new (LoadIdleData, 1);
-#endif
-
   data->window = window;
   data->game_file = g_strdup (game_file);
   data->seed = seed;
diff --git a/libgames-support/games-glib-compat.h b/libgames-support/games-glib-compat.h
index f8bd1bc..e824513 100644
--- a/libgames-support/games-glib-compat.h
+++ b/libgames-support/games-glib-compat.h
@@ -30,6 +30,8 @@ G_BEGIN_DECLS
 #define g_slice_new0(T) g_new0 (T, 1)
 #define g_slice_free(T,ptr) g_free (ptr)
 
+#define g_intern_static_string (string) g_quark_to_string(g_quark_from_static_string(string))
+
 #endif /* GLIB < 2.10 */
 
 #if !GLIB_CHECK_VERSION (2, 14, 0)



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