[gnome-maps] sidebar: Port to GtkRevealer and GtkButton



commit 6b1db29a0a0b3be5ebe28fd72804e027d2408c5a
Author: Yosef Or Boczko <yoseforb gmail com>
Date:   Wed Aug 7 13:39:27 2013 +0300

    sidebar: Port to GtkRevealer and GtkButton
    
    and fix arrow icons in RTL locales
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705594

 configure.ac   |    1 -
 src/sidebar.js |   19 ++++++++++++-------
 2 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 003ce4e..aa1c906 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,6 @@ AC_SUBST(GLIB_COMPILE_RESOURCES)
 
 LIBGD_INIT([
   header-bar
-  revealer
   tagged-entry
   gir
 ])
diff --git a/src/sidebar.js b/src/sidebar.js
index 50286b8..b9d873e 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -26,7 +26,6 @@ const GLib = imports.gi.GLib;
 const Gtk = imports.gi.Gtk;
 const Champlain = imports.gi.Champlain;
 const GtkClutter = imports.gi.GtkClutter;
-const Gd = imports.gi.Gd;
 const MapView = imports.mapView;
 
 const Lang = imports.lang;
@@ -44,9 +43,15 @@ const Sidebar = new Lang.Class({
                                          y_expand: true,
                                          x_align: Clutter.ActorAlign.END });
 
+        let isRtl = (Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL);
+        let prevIconName = isRtl ? 'go-previous-rtl-symbolic' : 'go-previous-symbolic';
+        let nextIconName = isRtl ? 'go-next-rtl-symbolic' : 'go-next-symbolic';
+
         // create the button
-        let revealButton = new Gd.HeaderSimpleButton({ symbolic_icon_name: 'go-previous-symbolic',
-                                                       valign: Gtk.Align.CENTER });
+        let revealImage = new Gtk.Image ({ icon_name: prevIconName,
+                                           icon_size: Gtk.IconSize.MENU });
+        let revealButton = new Gtk.Button({ child: revealImage,
+                                            valign: Gtk.Align.CENTER });
         revealButton.get_style_context().add_class('osd');
         revealButton.show();
 
@@ -65,18 +70,18 @@ const Sidebar = new Lang.Class({
                                         width_request: 200 });
         container.get_style_context().add_class('maps-sidebar');
 
-        let revealer = new Gd.Revealer({ child: container,
+        let revealer = new Gtk.Revealer({ child: container,
                                          reveal_child: false,
-                                         orientation: Gtk.Orientation.VERTICAL });
+                                         transition_type: Gtk.RevealerTransitionType.CROSSFADE });
         revealer.show_all();
 
         revealButton.connect('clicked', (function() {
             if (revealer.reveal_child) {
                 revealer.reveal_child = false;
-                revealButton.symbolic_icon_name = 'go-previous-symbolic';
+                revealButton.symbolic_icon_name = prevIconName;
             } else {
                 revealer.reveal_child = true;
-                revealButton.symbolic_icon_name = 'go-next-symbolic';
+                revealButton.symbolic_icon_name = nextIconName;
             }
         }).bind(this));
 


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