[gnome-boxes/implement-model-filtering: 1/2] list-view: Remove ItemConnections and SizeGroup




commit be87efb696711a323d9490810e87ed4379ecc950
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Aug 10 10:45:09 2022 +0200

    list-view: Remove ItemConnections and SizeGroup
    
    This was an old attempt to introduce item relations with Collections.

 src/list-view.vala | 62 ------------------------------------------------------
 1 file changed, 62 deletions(-)
---
diff --git a/src/list-view.vala b/src/list-view.vala
index 6fc89f36..7c0c7805 100644
--- a/src/list-view.vala
+++ b/src/list-view.vala
@@ -7,51 +7,10 @@
     [GtkChild]
     private unowned Gtk.ListBox list_box;
 
-    private Gtk.SizeGroup size_group;
-
-    private HashTable<CollectionItem, ItemConnections> items_connections;
-
     private AppWindow window;
     private Boxes.ActionsPopover context_popover;
 
-    private class ItemConnections: Object {
-        private ulong categories_id;
-        private ulong name_id;
-        private ulong info_id;
-
-        public weak ListView view { get; private set; }
-        public Machine machine { get; private set; }
-
-        public ItemConnections (ListView view, Machine machine) {
-            this.view = view;
-            this.machine = machine;
-
-            categories_id = machine.config.notify["categories"].connect (() => {
-                view.list_box.invalidate_sort ();
-                view.list_box.invalidate_filter ();
-            });
-            name_id = machine.notify["name"].connect (() => {
-                view.list_box.invalidate_sort ();
-                view.list_box.invalidate_filter ();
-            });
-            info_id = machine.notify["info"].connect (() => {
-                view.list_box.invalidate_sort ();
-                view.list_box.invalidate_filter ();
-            });
-        }
-
-        public override void dispose () {
-            machine.config.disconnect (categories_id);
-            machine.disconnect (name_id);
-            machine.disconnect (info_id);
-            base.dispose ();
-        }
-    }
-
     construct {
-        items_connections = new HashTable<CollectionItem, ItemConnections> (direct_hash, direct_equal);
-
-        size_group = new Gtk.SizeGroup (Gtk.SizeGroupMode.VERTICAL);
         filter = new CollectionFilter ();
         filter.notify["text"].connect (() => {
             list_box.invalidate_filter ();
@@ -65,24 +24,9 @@ public void setup_ui (AppWindow window) {
         context_popover = new Boxes.ActionsPopover (window);
     }
 
-    private void add_row (Gtk.Widget row) {
-        var item = row as CollectionItem;
-        var machine = item as Machine;
-
-        items_connections[item] = new ItemConnections (this, machine);
-    }
-
-    private void remove_row (Gtk.Widget row) {
-        var item = row as CollectionItem;
-        items_connections.remove (item);
-
-        size_group.remove_widget (row);
-    }
-
     private void setup_list_box () {
         list_box.bind_model (App.app.collection.items, (item) => {
             var box_row = new Gtk.ListBoxRow ();
-            size_group.add_widget (box_row);
             var view_row = new ListViewRow (item as CollectionItem);
             box_row.add (view_row);
 
@@ -96,14 +40,8 @@ private void setup_list_box () {
             return box_row;
         });
         list_box.set_filter_func (model_filter);
-
-        var container = list_box as Gtk.Container;
-        container.add.connect (add_row);
-        container.remove.connect (remove_row);
     }
 
-
-
     private CollectionItem? get_item_for_row (Gtk.ListBoxRow box_row) {
         var view = box_row.get_child () as ListViewRow;
         if (view == null)


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