[evince/hildon-2-28] shell: [maemo5] Add custom gtkrc file to redefine stock icons



commit 8370d228c6b623c8ea7c1f9788580ff0b82ba875
Author: Christian Persch <chpe gnome org>
Date:   Thu Nov 26 21:59:13 2009 +0100

    shell: [maemo5] Add custom gtkrc file to redefine stock icons
    
    On maemo5, the stock icons aren't available in the toolbar size used, which
    makes them blurry due to scaling. Add a custom gtkrc file to re-define
    the stock icons using the platform icons that are available in the
    required size.
    
    Analogous to bug #584669.

 data/Makefile.am  |    7 +++++++
 data/gtkrc-hildon |   24 ++++++++++++++++++++++++
 shell/main.c      |   14 ++++++++++++++
 3 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 3df91e5..8ff55ab 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -30,6 +30,13 @@ if ENABLE_PREVIEWER
 ui_DATA += evince-previewer-ui.xml
 endif
 
+# GtkRC file
+
+if PLATFORM_HILDON
+rcdir = $(pkgdatadir)
+dist_rc_DATA = gtkrc-hildon
+endif
+
 #
 # Desktop file
 #
diff --git a/data/gtkrc-hildon b/data/gtkrc-hildon
new file mode 100644
index 0000000..a4a719f
--- /dev/null
+++ b/data/gtkrc-hildon
@@ -0,0 +1,24 @@
+# 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 (cf. bug #584669).
+
+style "evince-icons" {
+  stock["gtk-open"] = { { @"general_folder" } }
+
+  stock["gtk-close"] = { { @"general_close" } }
+  stock["close"]     = { { @"general_close" } }
+
+  stock["gtk-goto-top"]    = { { @"pdf_viewer_first_page", LTR }, { @"pdf_viewer_last_page",  RTL } }
+  stock["gtk-goto-bottom"] = { { @"pdf_viewer_last_page",  LTR }, { @"pdf_viewer_first_page", RTL } }
+  
+  stock["gtk-go-up"]   = { { @"general_back",    LTR }, { @"general_forward", RTL } }
+  stock["gtk-go-down"] = { { @"general_forward", LTR }, { @"general_back",    RTL } }
+
+  stock["gtk-undo"] = { { @"general_undo", LTR }, { @"general_redo", RTL } }
+  stock["gtk-redo"] = { { @"general_redo", LTR }, { @"general_undo", RTL } }
+
+  stock["gtk-fullscreen"]       = { { @"general_fullsize" } }
+  stock["gtk-leave-fullscreen"] = { { @"general_fullsize" } }
+}
+
+class "GtkWidget" style "evince-icons"
diff --git a/shell/main.c b/shell/main.c
index 62e3606..af246aa 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -449,6 +449,20 @@ main (int argc, char *argv[])
 
 	g_option_context_add_group (context, gtk_get_option_group (TRUE));
 
+#ifdef PLATFORM_HILDON
+  {
+    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 = g_build_filename (DATADIR, "gtkrc-hildon", NULL);
+    gtk_rc_add_default_file (rc_file);
+    g_free (rc_file);
+  }
+#endif /* PLATFORM_HILDON */
+
 	if (!g_option_context_parse (context, &argc, &argv, &error)) {
 		g_printerr ("Cannot parse arguments: %s", error->message);
 		g_error_free (error);



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