gnome-games r8467 - in trunk: blackjack/src libgames-support



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

Log:
Fix blackjack to work with the changed theme API.

Modified:
   trunk/blackjack/src/blackjack.cpp
   trunk/blackjack/src/blackjack.h
   trunk/blackjack/src/card.cpp
   trunk/libgames-support/games-card-images.c

Modified: trunk/blackjack/src/blackjack.cpp
==============================================================================
--- trunk/blackjack/src/blackjack.cpp	(original)
+++ trunk/blackjack/src/blackjack.cpp	Tue Jan  6 18:19:33 2009
@@ -532,7 +532,7 @@
 }
 
 void
-bj_set_card_style (gchar *value)
+bj_set_card_style (const char *value)
 {
         games_conf_set_string (KEY_DECK_GROUP, KEY_CARD_STYLE, value);
 }

Modified: trunk/blackjack/src/blackjack.h
==============================================================================
--- trunk/blackjack/src/blackjack.h	(original)
+++ trunk/blackjack/src/blackjack.h	Tue Jan  6 18:19:33 2009
@@ -106,7 +106,7 @@
 void bj_set_balance (gdouble);
 
 gchar *bj_get_card_style (void);
-void bj_set_card_style (gchar *);
+void bj_set_card_style (const char *);
 gboolean bj_get_show_probabilities (void);
 void bj_set_show_probabilities (gboolean);
 gboolean bj_get_show_toolbar (void);

Modified: trunk/blackjack/src/card.cpp
==============================================================================
--- trunk/blackjack/src/card.cpp	(original)
+++ trunk/blackjack/src/card.cpp	Tue Jan  6 18:19:33 2009
@@ -157,15 +157,16 @@
 {
         GamesCardTheme *new_theme;
 
+        g_assert (theme != NULL);
+
         new_theme = games_card_theme_get_by_name (card_theme);
         if (!new_theme) {
-          g_warning ("Failed to load theme %s\n", card_theme);
-          return;
+                g_warning ("Failed to load theme %s\n", card_theme);
+                return;
         }
 
-        games_card_images_set_theme (images, theme);
-        
         theme = new_theme;
+        games_card_images_set_theme (images, theme);
         g_object_unref (theme);
 
         bj_draw_rescale_cards ();
@@ -176,7 +177,9 @@
 void
 card_deck_options_changed (GtkWidget *w, GamesCardThemeInfo *info, gpointer data)
 {
-#warning FIXMEchpe
+  g_assert (info != NULL);
+
+  bj_set_card_style (games_card_theme_info_get_persistent_name (info));
 }
 
 GtkWidget *
@@ -187,7 +190,7 @@
   if (!theme)
     return NULL;
 
-  selector = games_card_selector_new (games_card_theme_get_theme (theme));
+  selector = games_card_selector_new (games_card_theme_get_theme_info (theme));
   g_signal_connect (selector, "changed",
                     G_CALLBACK (card_deck_options_changed), NULL);
 

Modified: trunk/libgames-support/games-card-images.c
==============================================================================
--- trunk/libgames-support/games-card-images.c	(original)
+++ trunk/libgames-support/games-card-images.c	Tue Jan  6 18:19:33 2009
@@ -217,12 +217,12 @@
   games_card_images_clear_cache (images);
   g_free (images->cache);
 
-  if (images->theme)
+  if (images->theme) {
     g_signal_handlers_disconnect_by_func (images->theme,
                                           G_CALLBACK (games_card_images_theme_changed_cb),
                                           images);
-
-  g_object_unref (images->theme);
+    g_object_unref (images->theme);
+  }
 
   G_OBJECT_CLASS (games_card_images_parent_class)->finalize (object);
 }
@@ -312,6 +312,7 @@
                                           G_CALLBACK (games_card_images_theme_changed_cb),
                                           images);
     games_card_images_clear_cache (images);
+    g_object_unref (images->theme);
   }
 
   images->theme = theme;



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