[gnome-maps] searchPopup: make GtkStack the top-level widget



commit 2c533ed05cb098bc41428c765946b7d95bcfc307
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Thu Feb 6 13:45:11 2014 +0100

    searchPopup: make GtkStack the top-level widget
    
    It is bad practice to add children that can not scroll to a
    GtkScrolledWindow.
    
    This patch makes the GtkStack the top-level widget of the
    search-popup ui file. With this patch the GtkTreeView will be the
    only child of the GtkScrolledWindow.
    
    This change also fixes a buglet where the spinner would not be
    centered in the visible popup when scrollbars where visible.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722869

 src/search-popup.ui |   43 +++++++++++++++++++------------------------
 src/searchPopup.js  |    4 ++--
 2 files changed, 21 insertions(+), 26 deletions(-)
---
diff --git a/src/search-popup.ui b/src/search-popup.ui
index 5547c7d..13696c4 100644
--- a/src/search-popup.ui
+++ b/src/search-popup.ui
@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.10 -->
-  <object class="GtkFrame" id="frame">
+  <object class="GtkStack" id="stack">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
+    <property name="transition-type">crossfade</property>
     <style>
       <class name="search-popup" />
     </style>
@@ -12,36 +13,30 @@
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="hscrollbar_policy">never</property>
+        <property name="shadow_type">in</property>
         <child>
-          <object class="GtkStack" id="stack">
+          <object class="GtkTreeView" id="treeview">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="transition-type">crossfade</property>
-            <child>
-              <object class="GtkTreeView" id="treeview">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="expand">True</property>
-                <property name="headers-visible">False</property>
-                <property name="hover-selection">True</property>
-                <child internal-child="selection">
-                  <object class="GtkTreeSelection" id="treeview-selection"/>
-                </child>
-              </object>
-            </child>
-            <child>
-              <object class="GtkSpinner" id="spinner">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="halign">center</property>
-                <property name="valign">center</property>
-                <property name="width_request">16</property>
-                <property name="height_request">16</property>
-              </object>
+            <property name="expand">True</property>
+            <property name="headers-visible">False</property>
+            <property name="hover-selection">True</property>
+            <child internal-child="selection">
+              <object class="GtkTreeSelection" id="treeview-selection"/>
             </child>
           </object>
         </child>
       </object>
     </child>
+    <child>
+      <object class="GtkSpinner" id="spinner">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">center</property>
+        <property name="valign">center</property>
+        <property name="width_request">16</property>
+        <property name="height_request">16</property>
+      </object>
+    </child>
   </object>
 </interface>
diff --git a/src/searchPopup.js b/src/searchPopup.js
index 44dc0d2..40aa391 100644
--- a/src/searchPopup.js
+++ b/src/searchPopup.js
@@ -60,7 +60,7 @@ const SearchPopup = new Lang.Class({
                       no_show_all: true,
                       visible: true });
 
-        this.add(ui.frame);
+        this.add(this._stack);
         this.hide();
     },
 
@@ -116,7 +116,7 @@ const SearchPopup = new Lang.Class({
         if (this._spinner.active)
             this._spinner.stop();
 
-        this._stack.set_visible_child(this._treeView);
+        this._stack.set_visible_child(this._scrolledWindow);
 
         if (!this.get_visible())
             this.show();


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