[gnome-chess] Rely on RTL icon theme support



commit 530ffa05e58fd30363bb4634498128e2f48a64b5
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Thu Jun 5 10:28:24 2014 -0500

    Rely on RTL icon theme support

 data/gnome-chess.ui  |   32 +++++++++++++++++++++++++++-----
 src/gnome-chess.vala |   18 +-----------------
 2 files changed, 28 insertions(+), 22 deletions(-)
---
diff --git a/data/gnome-chess.ui b/data/gnome-chess.ui
index 4557c96..15eba28 100644
--- a/data/gnome-chess.ui
+++ b/data/gnome-chess.ui
@@ -44,9 +44,11 @@
               <class name="image-button"/>
             </style>
             <child>
-              <object class="GtkImage" id="undo_move_image">
+              <object class="GtkImage">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="icon_size">1</property>
+                <property name="icon_name">edit-undo-symbolic</property>
               </object>
             </child>
           </object>
@@ -168,10 +170,15 @@
                         <property name="tooltip_text" translatable="yes" comments="Tooltip on the show first 
move (i.e. game start) navigation button">Rewind to the game start</property>
                         <accelerator key="Left" signal="activate" modifiers="GDK_SHIFT_MASK | 
GDK_MOD1_MASK"/>
                         <signal name="clicked" handler="history_start_clicked_cb" swapped="no"/>
+                        <style>
+                          <class name="image-button"/>
+                        </style>
                         <child>
-                          <object class="GtkImage" id="first_move_image">
+                          <object class="GtkImage">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="icon_size">1</property>
+                            <property name="icon_name">go-first-symbolic</property>
                           </object>
                         </child>
                       </object>
@@ -190,10 +197,15 @@
                         <property name="tooltip_text" translatable="yes" comments="Tooltip on the show 
previous move navigation button">Show the previous move</property>
                         <accelerator key="Left" signal="activate" modifiers="GDK_MOD1_MASK"/>
                         <signal name="clicked" handler="history_previous_clicked_cb" swapped="no"/>
+                        <style>
+                          <class name="image-button"/>
+                        </style>
                         <child>
-                          <object class="GtkImage" id="prev_move_image">
+                          <object class="GtkImage">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="icon_size">1</property>
+                            <property name="icon_name">go-previous-symbolic</property>
                           </object>
                         </child>
                       </object>
@@ -212,10 +224,15 @@
                         <property name="tooltip_text" translatable="yes" comments="Tooltip on the show next 
move navigation button">Show the next move</property>
                         <accelerator key="Right" signal="activate" modifiers="GDK_MOD1_MASK"/>
                         <signal name="clicked" handler="history_next_clicked_cb" swapped="no"/>
+                        <style>
+                          <class name="image-button"/>
+                        </style>
                         <child>
-                          <object class="GtkImage" id="next_move_image">
+                          <object class="GtkImage">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="icon_size">1</property>
+                            <property name="icon_name">go-next-symbolic</property>
                           </object>
                         </child>
                       </object>
@@ -234,10 +251,15 @@
                         <property name="tooltip_text" translatable="yes" comments="Tooltip on the show 
current move navigation button">Show the current move</property>
                         <accelerator key="Right" signal="activate" modifiers="GDK_SHIFT_MASK | 
GDK_MOD1_MASK"/>
                         <signal name="clicked" handler="history_latest_clicked_cb" swapped="no"/>
+                        <style>
+                          <class name="image-button"/>
+                        </style>
                         <child>
-                          <object class="GtkImage" id="last_move_image">
+                          <object class="GtkImage">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="icon_size">1</property>
+                            <property name="icon_name">go-last-symbolic</property>
                           </object>
                         </child>
                       </object>
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index dd2896b..5b27f55 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -126,16 +126,11 @@ public class Application : Gtk.Application
             warning ("Could not load UI: %s", e.message);
         }
         window = (Gtk.ApplicationWindow) builder.get_object ("gnome_chess_app");
-        var undo_move_image = (Gtk.Image) builder.get_object ("undo_move_image");
         pause_resume_button = (Gtk.Button) builder.get_object ("pause_button");
         first_move_button = (Gtk.Widget) builder.get_object ("first_move_button");
         prev_move_button = (Gtk.Widget) builder.get_object ("prev_move_button");
         next_move_button = (Gtk.Widget) builder.get_object ("next_move_button");
         last_move_button = (Gtk.Widget) builder.get_object ("last_move_button");
-        var first_move_image = (Gtk.Image) builder.get_object ("first_move_image");
-        var prev_move_image = (Gtk.Image) builder.get_object ("prev_move_image");
-        var next_move_image = (Gtk.Image) builder.get_object ("next_move_image");
-        var last_move_image = (Gtk.Image) builder.get_object ("last_move_image");
         history_combo = (Gtk.ComboBox) builder.get_object ("history_combo");
         white_time_label = (Gtk.Widget) builder.get_object ("white_time_label");
         black_time_label = (Gtk.Widget) builder.get_object ("black_time_label");
@@ -145,14 +140,6 @@ public class Application : Gtk.Application
 
         update_pause_resume_button ();
 
-        bool rtl = Gtk.Widget.get_default_direction () == Gtk.TextDirection.RTL;
-
-        first_move_image.icon_name = rtl ? "go-first-rtl-symbolic" : "go-first-symbolic";
-        prev_move_image.icon_name = rtl ? "go-previous-rtl-symbolic" : "go-previous-symbolic";
-        next_move_image.icon_name = rtl ? "go-next-rtl-symbolic" : "go-next-symbolic";
-        last_move_image.icon_name = rtl ? "go-last-rtl-symbolic" : "go-last-symbolic";
-        undo_move_image.icon_name = rtl ? "edit-undo-rtl-symbolic" : "edit-undo-symbolic";
-
         window.add_action_entries (window_entries, this);
 
         add_window (window);
@@ -1114,10 +1101,7 @@ public class Application : Gtk.Application
 
         if (game != null && game.is_paused)
         {
-            bool rtl = Gtk.Widget.get_default_direction () == Gtk.TextDirection.RTL;
-
-            pause_resume_button.image = new Gtk.Image.from_icon_name (rtl ? 
"media-playback-start-rtl-symbolic" :
-                                                                            "media-playback-start-symbolic",
+            pause_resume_button.image = new Gtk.Image.from_icon_name ("media-playback-start-symbolic",
                                                                       Gtk.IconSize.BUTTON);
             pause_resume_button.tooltip_text = _("Unpause the game");
         }


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