[gnome-maps] searchPopup: Convert to GtkPopover



commit dbe68f28484b858abfeb2099130d03647af22e7d
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Thu Feb 6 13:47:29 2014 +0100

    searchPopup: Convert to GtkPopover
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722869

 data/gnome-maps.css |    8 +++-----
 src/mainWindow.js   |    4 +---
 src/search-popup.ui |    3 ---
 src/searchPopup.js  |   16 +++++++---------
 4 files changed, 11 insertions(+), 20 deletions(-)
---
diff --git a/data/gnome-maps.css b/data/gnome-maps.css
index 9a1745d..90b699a 100644
--- a/data/gnome-maps.css
+++ b/data/gnome-maps.css
@@ -7,11 +7,9 @@
 }
 
 .search-popup {
-       border-style: solid;
-       border-width: 5px;
-       border-color: black;
-       border-radius: 6px 6px 6px 6px;
-       background-color: white;
+       margin: 0px;
+       padding: 5px;
+       border-radius: 0px;
 }
 
 .zoom-control {
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 97f6261..00fd633 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -82,8 +82,6 @@ const MainWindow = new Lang.Class({
         this._initSignals();
         this._restoreWindowGeometry();
 
-        this._mapOverlay.add_overlay(this._searchPopup);
-
         grid.add(this._mapOverlay);
 
         grid.show_all();
@@ -100,7 +98,7 @@ const MainWindow = new Lang.Class({
     },
 
     _initSearchWidgets: function() {
-        this._searchPopup = new SearchPopup.SearchPopup(10);
+        this._searchPopup = new SearchPopup.SearchPopup(this._searchEntry, 10);
 
         let model = new Gtk.ListStore();
         model.set_column_types([GdkPixbuf.Pixbuf,
diff --git a/src/search-popup.ui b/src/search-popup.ui
index 13696c4..1d67507 100644
--- a/src/search-popup.ui
+++ b/src/search-popup.ui
@@ -5,9 +5,6 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="transition-type">crossfade</property>
-    <style>
-      <class name="search-popup" />
-    </style>
     <child>
       <object class="GtkScrolledWindow" id="scrolled-window">
         <property name="visible">True</property>
diff --git a/src/searchPopup.js b/src/searchPopup.js
index 40aa391..aa33a05 100644
--- a/src/searchPopup.js
+++ b/src/searchPopup.js
@@ -30,16 +30,15 @@ const Columns = {
 
 const SearchPopup = new Lang.Class({
     Name: 'SearchPopup',
-    Extends: Gtk.Bin,
+    Extends: Gtk.Popover,
 
-    _init: function(numVisible) {
+    _init: function(relativeTo, numVisible) {
         this._numVisible = numVisible;
 
-        let ui = Utils.getUIObject('search-popup', ['frame',
-                                                    'scrolled-window',
+        let ui = Utils.getUIObject('search-popup', ['scrolled-window',
                                                     'stack',
                                                     'spinner',
-                                                    'treeview']);
+                                                    'treeview',]);
 
         this._stack = ui.stack;
         this._scrolledWindow = ui.scrolledWindow;
@@ -53,13 +52,12 @@ const SearchPopup = new Lang.Class({
         this.height_request = this._cellHeight * this._numVisible;
         this._scrolledWindow.set_min_content_height(this.height_request);
 
-        this.parent({ width_request: 500,
-                      halign: Gtk.Align.CENTER,
-                      valign: Gtk.Align.START,
-                      margin_top: 10,
+        this.parent({ relative_to: relativeTo,
+                      width_request: 500,
                       no_show_all: true,
                       visible: true });
 
+        this.get_style_context().add_class('search-popup');
         this.add(this._stack);
         this.hide();
     },


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