[gnome-games] aisleriot: Also look for card themes in the system prefix



commit c1b5e813b7fe347e3f12aa100f200ddcc6344607
Author: Christian Persch <chpe gnome org>
Date:   Tue Sep 7 13:39:42 2010 +0200

    aisleriot: Also look for card themes in the system prefix
    
    When we're installed in a non-/usr prefix, we still want to try to find
    the card themes from /usr.

 aisleriot/lib/ar-card-theme-fixed.c  |    9 ++++++++-
 aisleriot/lib/ar-card-theme-kde.c    |    9 +++++++--
 aisleriot/lib/ar-card-theme-pysol.c  |    9 +++++++--
 aisleriot/lib/ar-card-theme-sliced.c |   11 ++++++++++-
 aisleriot/lib/ar-card-theme-svg.c    |   11 ++++++++++-
 5 files changed, 42 insertions(+), 7 deletions(-)
---
diff --git a/aisleriot/lib/ar-card-theme-fixed.c b/aisleriot/lib/ar-card-theme-fixed.c
index 2d5a6b8..7fc46a8 100644
--- a/aisleriot/lib/ar-card-theme-fixed.c
+++ b/aisleriot/lib/ar-card-theme-fixed.c
@@ -341,7 +341,14 @@ ar_card_theme_fixed_class_foreach_theme_dir (ArCardThemeClass *klass,
 
   if (!callback (klass, games_runtime_get_directory (GAMES_RUNTIME_PRERENDERED_CARDS_DIRECTORY), data))
     return FALSE;
-  return FALSE;
+
+  /* If we're installed in a non-system prefix, also load the card themes
+   * from the system prefix.
+   */
+  if (!games_runtime_is_system_prefix ())
+    return callback (klass, "/usr/share/gnome-games-common/card-themes", data);
+
+  return TRUE;
 }
 
 static void
diff --git a/aisleriot/lib/ar-card-theme-kde.c b/aisleriot/lib/ar-card-theme-kde.c
index aaecf1e..9c41bd1 100644
--- a/aisleriot/lib/ar-card-theme-kde.c
+++ b/aisleriot/lib/ar-card-theme-kde.c
@@ -399,8 +399,13 @@ ar_card_theme_kde_class_foreach_theme_dir (ArCardThemeClass *klass,
   if (!_ar_card_theme_class_foreach_env (klass, "AR_CARD_THEME_PATH_KDE", callback, data))
     return FALSE;
 
-  /* FIXMEchpe: is this universal, or ubuntu specific? */
-  return callback (klass, "/usr/share/kde4/apps/carddecks", data);
+  /* If we're installed in a non-system prefix, also load the card themes
+   * from the system prefix.
+   */
+  if (!games_runtime_is_system_prefix ())
+    return callback (klass, "/usr/share/kde4/apps/carddecks", data);
+
+  return TRUE;
 }
 
 static void
diff --git a/aisleriot/lib/ar-card-theme-pysol.c b/aisleriot/lib/ar-card-theme-pysol.c
index 5287e84..e4a2501 100644
--- a/aisleriot/lib/ar-card-theme-pysol.c
+++ b/aisleriot/lib/ar-card-theme-pysol.c
@@ -408,8 +408,13 @@ ar_card_theme_pysol_class_foreach_theme_dir (ArCardThemeClass *klass,
   if (!_ar_card_theme_class_foreach_env (klass, "AR_CARD_THEME_PATH_PYSOL", callback, data))
     return FALSE;
 
-  /* FIXMEchpe: is this univeral or ubuntu specific? */
-  return callback (klass, "/usr/share/games/pysol", data);
+  /* If we're installed in a non-system prefix, also load the card themes
+   * from the system prefix.
+   */
+  if (!games_runtime_is_system_prefix ())
+    return callback (klass, "/usr/share/games/pysol", data);
+
+  return TRUE;
 }
 
 static void
diff --git a/aisleriot/lib/ar-card-theme-sliced.c b/aisleriot/lib/ar-card-theme-sliced.c
index e0d1855..fe786f8 100644
--- a/aisleriot/lib/ar-card-theme-sliced.c
+++ b/aisleriot/lib/ar-card-theme-sliced.c
@@ -227,7 +227,16 @@ ar_card_theme_sliced_class_foreach_theme_dir (ArCardThemeClass *klass,
   retval = callback (klass, dir, data);
   g_free (dir);
 
-  return retval;
+  if (!retval)
+    return FALSE;
+
+  /* If we're installed in a non-system prefix, also load the card themes
+   * from the system prefix.
+   */
+  if (!games_runtime_is_system_prefix ())
+    return callback (klass, "/usr/share/pixmaps/gnome-games-common/cards", data);
+
+  return TRUE;
 }
 
 static void
diff --git a/aisleriot/lib/ar-card-theme-svg.c b/aisleriot/lib/ar-card-theme-svg.c
index 53e69b5..7a05d7b 100644
--- a/aisleriot/lib/ar-card-theme-svg.c
+++ b/aisleriot/lib/ar-card-theme-svg.c
@@ -184,7 +184,16 @@ ar_card_theme_svg_class_foreach_theme_dir (ArCardThemeClass *klass,
   if (!_ar_card_theme_class_foreach_env (klass, "AR_CARD_THEME_PATH_SVG", callback, data))
     return FALSE;
 
-  return callback (klass, games_runtime_get_directory (GAMES_RUNTIME_SCALABLE_CARDS_DIRECTORY), data);
+  if (!callback (klass, games_runtime_get_directory (GAMES_RUNTIME_SCALABLE_CARDS_DIRECTORY), data))
+    return FALSE;
+
+  /* If we're installed in a non-system prefix, also load the card themes
+   * from the system prefix.
+   */
+  if (!games_runtime_is_system_prefix ())
+    return callback (klass, "/usr/share/gnome-games-common/cards", data);
+
+  return TRUE;
 }
 
 static void



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