[gnome-games] aisleriot: Fix card theme menu
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] aisleriot: Fix card theme menu
- Date: Sat, 19 Mar 2011 23:52:04 +0000 (UTC)
commit 795c35ebf4a887343b3d800a6f591bc5983e8702
Author: Christian Persch <chpe gnome org>
Date: Sun Mar 20 00:48:17 2011 +0100
aisleriot: Fix card theme menu
The order in which the card theme directories are scanned assumed
that the first theme with a given pref name is retained, but
the code actually replaced that one when further themes with the same
pref name were found. Fixing that fixes the card theme menu in
aisleriot to show the current theme correctly.
aisleriot/lib/ar-card-themes.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/aisleriot/lib/ar-card-themes.c b/aisleriot/lib/ar-card-themes.c
index a6cce28..3b3a594 100644
--- a/aisleriot/lib/ar-card-themes.c
+++ b/aisleriot/lib/ar-card-themes.c
@@ -270,11 +270,15 @@ ar_card_themes_get_theme_infos_in_dir (ArCardThemeClass *klass,
info = _ar_card_theme_class_get_theme_info (klass, path, filename);
_games_profile_end ("checking for %s card theme in file %s", G_OBJECT_CLASS_NAME (klass), filename);
- if (info)
- /* Replace existing info with the new one */
- g_hash_table_replace (theme_manager->theme_infos, info->pref_name, info);
+ if (info != NULL) {
+ /* Don't replace an already existing theme info! */
+ if (g_hash_table_lookup (theme_manager->theme_infos, info->pref_name))
+ ar_card_theme_info_unref (info);
+ else
+ g_hash_table_insert (theme_manager->theme_infos, info->pref_name, info);
+ }
}
-
+
g_dir_close (iter);
out:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]