[gnome-boxes] list-view: Make rows of equal height



commit 6467530e749b22ac50fce3d78c2b11eb9a70f107
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Aug 26 18:19:59 2015 +0100

    list-view: Make rows of equal height
    
    Make every row of the same height using size group.

 src/list-view.vala |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/list-view.vala b/src/list-view.vala
index 8ac9f20..cf9fd03 100644
--- a/src/list-view.vala
+++ b/src/list-view.vala
@@ -10,6 +10,8 @@ private class Boxes.ListView: Gtk.ScrolledWindow, Boxes.ICollectionView, Boxes.U
     [GtkChild]
     private Gtk.ListBox list_box;
 
+    private Gtk.SizeGroup size_group;
+
     private GLib.List<CollectionItem> hidden_items;
     private HashTable<CollectionItem, ItemConnections> items_connections;
 
@@ -56,6 +58,7 @@ private class Boxes.ListView: Gtk.ScrolledWindow, Boxes.ICollectionView, Boxes.U
 
         setup_list_box ();
 
+        size_group = new Gtk.SizeGroup (Gtk.SizeGroupMode.VERTICAL);
         filter = new CollectionFilter ();
         filter.notify["text"].connect (() => {
             list_box.invalidate_filter ();
@@ -118,6 +121,7 @@ private class Boxes.ListView: Gtk.ScrolledWindow, Boxes.ICollectionView, Boxes.U
 
     private void add_row (CollectionItem item) {
         var box_row = new Gtk.ListBoxRow ();
+        size_group.add_widget (box_row);
         var view_row = new ListViewRow (item);
 
         view_row.notify["selected"].connect (() => {
@@ -143,8 +147,10 @@ private class Boxes.ListView: Gtk.ScrolledWindow, Boxes.ICollectionView, Boxes.U
             if (view_row == null)
                 return;
 
-            if (view_row.item == item)
+            if (view_row.item == item) {
                 list_box.remove (box_row);
+                size_group.remove_widget (box_row);
+            }
         });
     }
 


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