gnome-games r8462 - in trunk: aisleriot libgames-support



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

Log:
Make the current card theme's menu item active.

Modified:
   trunk/aisleriot/window.c
   trunk/libgames-support/games-card-theme.c
   trunk/libgames-support/games-card-theme.h

Modified: trunk/aisleriot/window.c
==============================================================================
--- trunk/aisleriot/window.c	(original)
+++ trunk/aisleriot/window.c	Tue Jan  6 18:19:23 2009
@@ -1485,10 +1485,10 @@
     return;
 
   info = g_object_get_data (G_OBJECT (action), "card-theme-info");
-  g_return_if_fail (info != NULL);
+  g_assert (info != NULL);
 
   if (priv->theme != NULL &&
-      info == games_card_theme_get_theme (priv->theme))
+      info == games_card_theme_get_theme_info (priv->theme))
     return;
 
   theme = games_card_theme_get (info);
@@ -1504,7 +1504,7 @@
   AisleriotWindowPrivate *priv = window->priv;
   GList *list, *l;
   GSList *radio_group = NULL;
-  //GamesCardThemeInfo *card_theme;
+  GamesCardThemeInfo *current_theme_info;
   guint i = 0;
 
   /* Clean out the old menu */
@@ -1535,8 +1535,10 @@
 
   priv->card_themes_merge_id = gtk_ui_manager_new_merge_id (priv->ui_manager);
 
- // FIXMEchpe
-//  card_theme = aisleriot_board_get_card_theme (priv->board);
+  if (priv->theme)
+    current_theme_info = games_card_theme_get_theme_info (priv->theme);
+  else
+    current_theme_info = NULL;
 
   for (l = list; l != NULL; l = l->next) {
     GamesCardThemeInfo *info = (GamesCardThemeInfo *) l->data;
@@ -1544,7 +1546,7 @@
     char actionname[32];
     char *display_name, *tooltip;
 
-    display_name = g_strdup (games_card_theme_info_get_display_name (info)); //aisleriot_util_get_display_filename (theme);
+    display_name = g_strdup (games_card_theme_info_get_display_name (info));
 
     g_snprintf (actionname, sizeof (actionname), "Theme%d", i);
 #ifdef HAVE_HILDON
@@ -1559,11 +1561,10 @@
     gtk_radio_action_set_group (action, radio_group);
     radio_group = gtk_radio_action_get_group (action);
 
- // FIXMEchpe
     /* Check if this is the current theme's action. Do this before connecting the callback */
-//     if (games_card_theme_info_equal (card_theme, info)) {
-//       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
-//     }
+    if (info == current_theme_info) {
+      gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+    }
 
     /* We steal the data from the list */
     g_object_set_data_full (G_OBJECT (action), "card-theme-info",

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:19:23 2009
@@ -416,13 +416,13 @@
 
 
 /**
- * games_card_theme_get_theme:
+ * games_card_theme_get_theme_info:
  * @theme:
  *
  * Returns: the #GamesCardThemeInfo corresponding to @theme.
  */
 GamesCardThemeInfo *
-games_card_theme_get_theme (GamesCardTheme *theme)
+games_card_theme_get_theme_info (GamesCardTheme *theme)
 {
   g_return_val_if_fail (GAMES_IS_CARD_THEME (theme), 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:19:23 2009
@@ -76,7 +76,7 @@
 gboolean games_card_theme_set_theme (GamesCardTheme *theme,
                                      GamesCardThemeInfo *info);
 
-GamesCardThemeInfo *games_card_theme_get_theme (GamesCardTheme * theme);
+GamesCardThemeInfo *games_card_theme_get_theme_info (GamesCardTheme * theme);
 
 gboolean games_card_theme_set_size (GamesCardTheme * theme,
                                     int width,



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