[gnome-boxes/wip/exalm/light: 5/5] list-view: Clamp the list




commit 26a1d73b53ce793ab82bd4ab63c579d0e3187e24
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sat Dec 25 20:51:51 2021 +0500

    list-view: Clamp the list
    
    Remove the size-allocate hack.

 data/ui/list-view-row.ui |  4 ----
 data/ui/list-view.ui     | 38 ++++++++++++++++++++++----------------
 src/list-view.vala       | 15 ---------------
 3 files changed, 22 insertions(+), 35 deletions(-)
---
diff --git a/data/ui/list-view-row.ui b/data/ui/list-view-row.ui
index b0b7816d..8a174def 100644
--- a/data/ui/list-view-row.ui
+++ b/data/ui/list-view-row.ui
@@ -89,8 +89,6 @@
         <child>
           <object class="GtkLabel" id="machine_name">
             <property name="visible">True</property>
-            <property name="width-request">192</property>
-            <property name="max-width-chars">128</property>
             <property name="justify">left</property>
             <property name="halign">start</property>
             <property name="hexpand">True</property>
@@ -129,8 +127,6 @@
     <child>
       <object class="GtkLabel" id="status_label">
         <property name="visible">True</property>
-        <property name="width-request">192</property>
-        <property name="max-width-chars">0</property>
         <property name="justify">right</property>
         <property name="halign">end</property>
         <property name="valign">center</property>
diff --git a/data/ui/list-view.ui b/data/ui/list-view.ui
index 08c065a4..165e1065 100644
--- a/data/ui/list-view.ui
+++ b/data/ui/list-view.ui
@@ -4,9 +4,6 @@
   <template class="BoxesListView" parent="GtkScrolledWindow">
     <property name="visible">True</property>
     <property name="hscrollbar-policy">never</property>
-    <property name="vscrollbar-policy">automatic</property>
-    <property name="max-content-width">948</property>
-    <signal name="size-allocate" handler="on_size_allocate"/>
 
     <child>
       <object class="GtkBox">
@@ -17,22 +14,31 @@
         </style>
 
         <child>
-          <object class="GtkListBox" id="list_box">
+          <object class="HdyClamp">
             <property name="visible">True</property>
-            <property name="margin-start">24</property>
-            <property name="margin-end">24</property>
-            <property name="margin-top">12</property>
-            <property name="margin-bottom">12</property>
-            <property name="valign">start</property>
-            <signal name="button-release-event" handler="on_button_press_event"/>
-            <signal name="key-press-event" handler="on_key_press_event"/>
-            <style>
-              <class name="boxes-list-box"/>
-              <class name="view"/>
-              <class name="content-view"/>
-            </style>
+            <property name="maximum-size">900</property>
+
+            <child>
+              <object class="GtkListBox" id="list_box">
+                <property name="visible">True</property>
+                <property name="margin-start">24</property>
+                <property name="margin-end">24</property>
+                <property name="margin-top">12</property>
+                <property name="margin-bottom">12</property>
+                <property name="valign">start</property>
+                <signal name="button-release-event" handler="on_button_press_event"/>
+                <signal name="key-press-event" handler="on_key_press_event"/>
+                <style>
+                  <class name="boxes-list-box"/>
+                  <class name="view"/>
+                  <class name="content-view"/>
+                </style>
+              </object>
+            </child>
+
           </object>
         </child>
+
       </object>
     </child>
   </template>
diff --git a/src/list-view.vala b/src/list-view.vala
index 00f348fb..78bb7a09 100644
--- a/src/list-view.vala
+++ b/src/list-view.vala
@@ -347,19 +347,4 @@ public void unselect_all () {
 
         App.app.notify_property ("selected-items");
     }
-
-    [GtkCallback]
-    private void on_size_allocate (Gtk.Allocation allocation) {
-        // Work around for https://gitlab.gnome.org/GNOME/gnome-boxes/issues/76
-        bool small_screen = (allocation.width < max_content_width);
-
-        if (small_screen) {
-            list_box.halign = Gtk.Align.FILL;
-            list_box.set_size_request (-1, -1);
-        } else {
-            list_box.halign = Gtk.Align.CENTER;
-            // 100 here should cover margins, padding, and theme specifics.
-            list_box.set_size_request (max_content_width - 100, -1);
-        }
-    }
 }


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