[gnome-documents] searchbar: Use GtkMenuButton in OverviewSearchbar



commit 28ccbf6535f79e558bd97be40da7818cab90df13
Author: Alessandro Bono <abono gnome org>
Date:   Sat Apr 9 13:30:47 2016 +0200

    searchbar: Use GtkMenuButton in OverviewSearchbar
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765343

 src/searchbar.js |   25 ++++++-------------------
 1 files changed, 6 insertions(+), 19 deletions(-)
---
diff --git a/src/searchbar.js b/src/searchbar.js
index 5d6b7cd..d6b5986 100644
--- a/src/searchbar.js
+++ b/src/searchbar.js
@@ -127,11 +127,12 @@ const Dropdown = new Lang.Class({
     Name: 'Dropdown',
     Extends: Gtk.Popover,
 
-    _init: function(relativeTo) {
-        this.parent({ relative_to: relativeTo, position: Gtk.PositionType.BOTTOM });
+    _init: function() {
+        this.parent({ position: Gtk.PositionType.BOTTOM });
 
         let grid = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL,
-                                  row_homogeneous: true });
+                                  row_homogeneous: true,
+                                  visible: true });
         this.add(grid);
 
         [Application.sourceManager,
@@ -205,22 +206,8 @@ const OverviewSearchbar = new Lang.Class({
             }));
 
         // create the dropdown button
-        this._dropdownButton = new Gtk.ToggleButton(
-            { child: new Gtk.Image({ icon_name: 'pan-down-symbolic',
-                                     icon_size: Gtk.IconSize.MENU }) });
-        this._dropdownButton.get_style_context().add_class('image-button');
-        this._dropdownButton.connect('toggled', Lang.bind(this,
-            function() {
-                let active = this._dropdownButton.get_active();
-                if(active)
-                    this._dropdown.show_all();
-            }));
-
-        this._dropdown = new Dropdown(this._dropdownButton);
-        this._dropdown.connect('closed', Lang.bind(this,
-            function() {
-                this._dropdownButton.set_active(false);
-            }));
+        let dropdown = new Dropdown();
+        this._dropdownButton = new Gtk.MenuButton({ popover: dropdown });
 
         this._searchContainer = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
                                               halign: Gtk.Align.CENTER });


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