gnome-games r8420 - in trunk: aisleriot blackjack/src libgames-support



Author: chpe
Date: Tue Jan  6 18:18:07 2009
New Revision: 8420
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8420&view=rev

Log:
Add env var to control the card theme format, for debugging purposes.

Modified:
   trunk/aisleriot/board-noclutter.c
   trunk/aisleriot/board.c
   trunk/blackjack/src/card.cpp
   trunk/libgames-support/games-card-theme.c
   trunk/libgames-support/games-card-theme.h

Modified: trunk/aisleriot/board-noclutter.c
==============================================================================
--- trunk/aisleriot/board-noclutter.c	(original)
+++ trunk/aisleriot/board-noclutter.c	Tue Jan  6 18:18:07 2009
@@ -3357,11 +3357,7 @@
   g_assert (priv->game != NULL);
 
   /* Create this down here since we need to have the scalable_cards value */
-  if (priv->scalable_cards)
-    priv->theme = games_card_theme_svg_new ();
-  else
-    priv->theme = games_card_theme_fixed_new ();
-
+  priv->theme = games_card_theme_new ();
   priv->images = games_card_images_new (priv->theme);
 
   return object;

Modified: trunk/aisleriot/board.c
==============================================================================
--- trunk/aisleriot/board.c	(original)
+++ trunk/aisleriot/board.c	Tue Jan  6 18:18:07 2009
@@ -3184,11 +3184,7 @@
   g_assert (priv->game != NULL);
 
   /* Create this down here since we need to have the scalable_cards value */
-  if (priv->scalable_cards)
-    priv->theme = games_card_theme_svg_new ();
-  else
-    priv->theme = games_card_theme_fixed_new ();
-
+  priv->theme = games_card_theme_new ();
   priv->images = games_card_images_new (priv->theme);
   priv->textures = games_card_textures_cache_new (priv->images);
 

Modified: trunk/blackjack/src/card.cpp
==============================================================================
--- trunk/blackjack/src/card.cpp	(original)
+++ trunk/blackjack/src/card.cpp	Tue Jan  6 18:18:07 2009
@@ -119,17 +119,10 @@
         CardSize card_size;
 
         if (!theme) {
-                const char *env;
                 char *card_theme;
                 gboolean scalable;
 
-                env = g_getenv ("BLACKJACK_CARDS_SCALABLE");
-                scalable = env == NULL || g_ascii_strtoll (env, NULL, 10) != 0;
-
-                if (scalable)
-                          theme = games_card_theme_svg_new ();
-                else
-                          theme = games_card_theme_fixed_new ();
+                theme = games_card_theme_svg_new ();
 
                 images = games_card_images_new (theme);
                 g_object_unref (theme);

Modified: trunk/libgames-support/games-card-theme.c
==============================================================================
--- trunk/libgames-support/games-card-theme.c	(original)
+++ trunk/libgames-support/games-card-theme.c	Tue Jan  6 18:18:07 2009
@@ -302,3 +302,40 @@
 
   return pixbuf;
 }
+
+/**
+ * games_card_theme_sliced_new:
+ *
+ * Returns: a new #GamesCardThemeSliced
+ */
+GamesCardTheme *
+games_card_theme_new (void)
+{
+  GType type = G_TYPE_INVALID;
+  const char *env;
+
+#if defined(HAVE_RSVG) && !defined(HAVE_HILDON)
+  /* Default to scalable */
+  type = GAMES_TYPE_CARD_THEME_SVG;
+#else
+  /* Default to non-scalable */
+  type = GAMES_TYPE_CARD_THEME_FIXED;
+#endif
+
+#ifndef HAVE_HILDON
+  env = g_getenv ("GAMES_CARD_THEME_FORMAT");
+  if (env) {
+#ifdef HAVE_RSVG
+    if (strcmp (env, "svg") == 0)
+      type = GAMES_TYPE_CARD_THEME_SVG;
+    else
+#endif
+    if (strcmp (env, "sliced") == 0)
+      type = GAMES_TYPE_CARD_THEME_SLICED;
+    else if (strcmp (env, "fixed") == 0)
+      type = GAMES_TYPE_CARD_THEME_FIXED;
+  }
+#endif /* !HAVE_HILDON */
+
+  return g_object_new (type, NULL);
+}

Modified: trunk/libgames-support/games-card-theme.h
==============================================================================
--- trunk/libgames-support/games-card-theme.h	(original)
+++ trunk/libgames-support/games-card-theme.h	Tue Jan  6 18:18:07 2009
@@ -140,4 +140,8 @@
 
 G_END_DECLS
 
+/* Utility functions */
+
+GamesCardTheme *games_card_theme_new (void);
+
 #endif /* GAMES_CARD_THEME_H */



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