[gnome-games] aisleriot: maemo5: Redefine stock icons using a custom gtkrc file



commit fbaada8c8091c3fdd61f873b84dbaf7ae81be382
Author: Christian Persch <chpe gnome org>
Date:   Wed Nov 25 21:11:07 2009 +0100

    aisleriot: maemo5: Redefine stock icons using a custom gtkrc file
    
    Since the stock gtk icons we use aren't available on the device in the
    required toolbar icon size (48x48), and to use icons that look better in
    the device's theme, re-define the stock icons using a custom gtkrc file
    on maemo5.
    
    This is an initial try; there may be better choices for which hildon
    icons to use for which stock icon.
    
    Bug #584669.

 aisleriot/Makefile.am |    9 ++++++++-
 aisleriot/gtkrc-maemo |   21 +++++++++++++++++++++
 aisleriot/sol.c       |   14 ++++++++++++++
 3 files changed, 43 insertions(+), 1 deletions(-)
---
diff --git a/aisleriot/Makefile.am b/aisleriot/Makefile.am
index cbeee21..935699f 100644
--- a/aisleriot/Makefile.am
+++ b/aisleriot/Makefile.am
@@ -153,6 +153,7 @@ ossoscript_in_files = aisleriot-clean.sh
 ossoservice_in_files = org.gnome.Games.AisleRiot.service.in
 
 if HAVE_MAEMO
+
 ossobackupdir = $(sysconfdir)/osso-backup/applications
 ossobackup_DATA = $(ossobackup_in_files)
 
@@ -161,7 +162,13 @@ ossocud_SCRIPTS = $(ossoscript_in_files)
 
 servicedir = $(shell $(PKG_CONFIG) osso-af-settings --variable=dbusservicedir)
 service_DATA = $(ossoservice_in_files:.service.in=.service)
-endif
+
+if HAVE_MAEMO_5
+rcdir = $(pkgdatadir)/aisleriot
+dist_rc_DATA = gtkrc-maemo
+endif # HAVE_MAEMO_5
+
+endif # HAVE_MAEMO
 
 %.service: %.service.in Makefile
 	$(AM_V_GEN) $(SED) -e "s|%bindir%|$(bindir)|" $< > $@
diff --git a/aisleriot/gtkrc-maemo b/aisleriot/gtkrc-maemo
new file mode 100644
index 0000000..8ca6bc7
--- /dev/null
+++ b/aisleriot/gtkrc-maemo
@@ -0,0 +1,21 @@
+# Re-define the icons used in the toolbar
+# These icons a) look nicer, and b) are available in the required
+# sizes, so that the toolbar icons aren't blurry (bug #584669).
+
+style "aisleriot-icons" {
+  stock["games-new-game"]         = { { @"filemanager_game_file" } }
+  stock["games-restart-game"]     = { { @"general_refresh" } }
+  stock["gtk-index"]              = { { @"notes_bullets" } } # or maybe camera_camera_settings ?
+#  stock["games-undo-move"]        = { { @"general_back",    LTR }, { @"general_forward", RTL } }
+#  stock["games-redo-move"]        = { { @"general_forward", LTR }, { @"general_back",    RTL } }
+  stock["games-undo-move"]        = { { @"general_undo", LTR }, { @"general_redo", RTL } }
+  stock["games-redo-move"]        = { { @"general_redo", LTR }, { @"general_undo", RTL } }
+  stock["games-cards-deal"]       = { { @"chat_enter" } }
+  stock["games-hint"]             = { { @"general_information" } } # or general_help ? general_search?
+
+  stock["games-fullscreen"]       = { { @"general_fullsize" } }
+  stock["games-leave-fullscreen"] = { { @"general_fullsize" } }
+}
+
+# FIXME use GtkImage?
+class "*" style "aisleriot-icons"
diff --git a/aisleriot/sol.c b/aisleriot/sol.c
index 2e72e2a..8fd49bf 100644
--- a/aisleriot/sol.c
+++ b/aisleriot/sol.c
@@ -277,6 +277,20 @@ main_prog (void *closure, int argc, char *argv[])
   g_option_context_add_group (option_context, clutter_get_option_group_without_init ());
 #endif
 
+#if defined(HAVE_HILDON) && defined(HAVE_MAEMO_5)
+  {
+    char *rc_file;
+
+    /* Note: we have to use gtk_rc_add_default_file() before calling gtk_init() (via
+     * g_option_context_parse()) rather than parsing the file directly afterward, in
+     * order to get priority over the theme.
+     */
+    rc_file = games_runtime_get_file (GAMES_RUNTIME_GAME_DATA_DIRECTORY, "gtkrc-maemo");
+    gtk_rc_add_default_file (rc_file);
+    g_free (rc_file);
+  }
+#endif /* HAVE_HILDON && HAVE_MAEMO_5 */
+
   retval = g_option_context_parse (option_context, &argc, &argv, &error);
   g_option_context_free (option_context);
 



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