[gnome-maps/wip/cdavis/post-port-cleanups: 17/22] placePopover: Stop hardcoding height




commit dcbb32525a9a7b30e10436313300f4f3b4ca3308
Author: Christopher Davis <christopherdavis gnome org>
Date:   Sun Aug 21 14:12:19 2022 -0400

    placePopover: Stop hardcoding height
    
    Suggestion popovers should use the height of the entries
    up to a certain point.
    
    This commit removes the hardcoded height request and
    sets a maximum height instead. This maximum value
    is the same as the one from the Epiphany port.

 data/ui/place-popover.ui | 3 ++-
 src/placeEntry.js        | 9 +++------
 src/placePopover.js      | 6 ------
 3 files changed, 5 insertions(+), 13 deletions(-)
---
diff --git a/data/ui/place-popover.ui b/data/ui/place-popover.ui
index 46f5bcc3..5c45f8db 100644
--- a/data/ui/place-popover.ui
+++ b/data/ui/place-popover.ui
@@ -5,7 +5,6 @@
     <property name="visible">False</property>
     <property name="hexpand">False</property>
     <property name="has-arrow">False</property>
-    <property name="height-request">320</property>
     <style>
       <class name="menu"/>
     </style>
@@ -18,6 +17,8 @@
         <child>
           <object class="GtkScrolledWindow" id="scrolledWindow">
             <property name="hscrollbar_policy">never</property>
+            <property name="max-content-height">400</property>
+            <property name="propagate-natural-height">True</property>
             <property name="child">
               <object class="GtkListBox" id="list">
                 <property name="hexpand">1</property>
diff --git a/src/placeEntry.js b/src/placeEntry.js
index bf89e302..96780502 100644
--- a/src/placeEntry.js
+++ b/src/placeEntry.js
@@ -85,8 +85,6 @@ export class PlaceEntry extends Gtk.SearchEntry {
     }
 
     constructor(props) {
-        let numVisible = props.num_visible ?? 6;
-        delete props.num_visible;
         let mapView = props.mapView;
         delete props.mapView;
 
@@ -103,7 +101,7 @@ export class PlaceEntry extends Gtk.SearchEntry {
         this._filter = new Gtk.TreeModelFilter({ child_model: Application.placeStore });
         this._filter.set_visible_func(this._completionVisibleFunc.bind(this));
 
-        this._popover = this._createPopover(numVisible, maxChars);
+        this._popover = this._createPopover(maxChars);
 
         this.connect('search-changed', this._onSearchChanged.bind(this));
 
@@ -170,9 +168,8 @@ export class PlaceEntry extends Gtk.SearchEntry {
                 placeA.location.longitude === placeB.location.longitude);
     }
 
-    _createPopover(numVisible, maxChars) {
-        let popover = new PlacePopover({ num_visible:   numVisible,
-                                         entry:         this,
+    _createPopover(maxChars) {
+        let popover = new PlacePopover({ entry:         this,
                                          maxChars:      maxChars });
 
         popover.set_parent(this);
diff --git a/src/placePopover.js b/src/placePopover.js
index 836ad49a..36e59561 100644
--- a/src/placePopover.js
+++ b/src/placePopover.js
@@ -30,9 +30,6 @@ const _PLACE_ICON_SIZE = 20;
 export class PlacePopover extends SearchPopover {
 
     constructor(props) {
-        let numVisible = props.num_visible;
-        delete props.num_visible;
-
         let maxChars = props.maxChars;
         delete props.maxChars;
 
@@ -45,9 +42,6 @@ export class PlacePopover extends SearchPopover {
                 this.emit('selected', row.place);
         });
 
-        let rowHeight = PlaceListRow.ROW_HEIGHT;
-        this._scrolledWindow.min_content_height = numVisible * rowHeight + 6;
-
         // This silents warning at Maps exit about this widget being
         // visible but not mapped.
         this.connect('unmap', (popover) => popover.hide());


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