[gnome-weather] city: Set the back and forward buttons icon according to locale's text direction



commit a6b1b95c89c774462407c3ecdc3940419c5ccacf
Author: Yosef Or Boczko <yoseforb gmail com>
Date:   Fri Dec 27 14:56:09 2013 +0200

    city: Set the back and forward buttons icon according to locale's text direction
    
    https://bugzilla.gnome.org/show_bug.cgi?id=721123

 data/city.ui |    1 -
 src/city.js  |    8 ++++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/data/city.ui b/data/city.ui
index 8f53a64..4931464 100644
--- a/data/city.ui
+++ b/data/city.ui
@@ -114,7 +114,6 @@
               <object class="GtkImage" id="reveal-button-image">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="icon-name">go-previous-symbolic</property>
                 <property name="icon-size">1</property>
               </object>
             </child>
diff --git a/src/city.js b/src/city.js
index a6d44be..d765a22 100644
--- a/src/city.js
+++ b/src/city.js
@@ -35,6 +35,8 @@ const WeatherWidget = new Lang.Class({
         let builder = new Gtk.Builder();
         builder.add_from_resource('/org/gnome/weather/city.ui');
 
+        let rtl = this.get_direction() == Gtk.TextDirection.RTL;
+
         let outerBox = builder.get_object('outer-box');
         this._contentFrame = builder.get_object('content-frame');
         let outerGrid = builder.get_object('outer-grid');
@@ -44,6 +46,8 @@ const WeatherWidget = new Lang.Class({
         this._revealButton = builder.get_object('reveal-button');
         this._revealer = builder.get_object('revealer');
 
+        this._revealButton.get_child().icon_name = rtl ? 'go-previous-rtl-symbolic' : 'go-previous-symbolic';
+
         this._forecasts = new Forecast.ForecastBox({ hexpand: true });
         outerGrid.attach(this._forecasts, 0, 1, 1, 1);
 
@@ -54,10 +58,10 @@ const WeatherWidget = new Lang.Class({
         this._revealButton.connect('clicked', Lang.bind(this, function() {
             if (this._revealer.reveal_child) {
                 this._revealer.reveal_child = false;
-                this._revealButton.get_child().icon_name = 'go-previous-symbolic';
+                this._revealButton.get_child().icon_name = rtl ? 'go-previous-rtl-symbolic' : 
'go-previous-symbolic';
             } else {
                 this._revealer.reveal_child = true;
-                this._revealButton.get_child().icon_name = 'go-next-symbolic';
+                this._revealButton.get_child().icon_name = rtl ? 'go-next-rtl-symbolic' : 'go-next-symbolic';
             }
         }));
 


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