[gnome-boxes] list-view: Use container remove signal to trigger cleanup
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] list-view: Use container remove signal to trigger cleanup
- Date: Mon, 8 Jan 2018 09:36:12 +0000 (UTC)
commit 3ee8564ab2a408c030c0d7dbd199793651448e4f
Author: Felipe Borges <felipeborges gnome org>
Date: Thu Jan 4 13:57:54 2018 +0100
list-view: Use container remove signal to trigger cleanup
Instead of relying on our own remove_item handler we can connect
to the "remove" signal of the list_view and trigger the cleanup
code which removes the item from the size group.
https://bugzilla.gnome.org/show_bug.cgi?id=791839
src/list-view.vala | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/src/list-view.vala b/src/list-view.vala
index 8c9812a..f188391 100644
--- a/src/list-view.vala
+++ b/src/list-view.vala
@@ -88,20 +88,13 @@ private class Boxes.ListView: Gtk.ScrolledWindow, Boxes.ICollectionView, Boxes.U
}
public void remove_item (CollectionItem item) {
- items_connections.remove (item);
- remove_row (item);
}
- private void remove_row (CollectionItem item) {
- foreach_row ((box_row) => {
- var view_row = box_row.get_child () as ListViewRow;
- if (view_row == null)
- return;
+ private void remove_row (Gtk.Widget row) {
+ var item = row as CollectionItem;
+ items_connections.remove (item);
- if (view_row.item == item) {
- size_group.remove_widget (box_row);
- }
- });
+ size_group.remove_widget (row);
}
public void select_by_criteria (SelectionCriteria criteria) {
@@ -184,6 +177,8 @@ private class Boxes.ListView: Gtk.ScrolledWindow, Boxes.ICollectionView, Boxes.U
window.select_item (item);
});
+ (list_box as Gtk.Container).remove.connect (remove_row);
+
update_selection_mode ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]