[gnome-boxes] list-view: Use container "add" signal to setup child
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] list-view: Use container "add" signal to setup child
- Date: Mon, 8 Jan 2018 09:36:17 +0000 (UTC)
commit b239f8df14dd1eb45949e341c3c47657112bd5b0
Author: Felipe Borges <felipeborges gnome org>
Date: Thu Jan 4 14:08:28 2018 +0100
list-view: Use container "add" signal to setup child
Instead of relying on our own add_item handler we can now connect
to the "add" signal of the list_view directly.
https://bugzilla.gnome.org/show_bug.cgi?id=791839
src/list-view.vala | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/list-view.vala b/src/list-view.vala
index f188391..2e28a33 100644
--- a/src/list-view.vala
+++ b/src/list-view.vala
@@ -82,14 +82,18 @@ private class Boxes.ListView: Gtk.ScrolledWindow, Boxes.ICollectionView, Boxes.U
}
public void add_item (CollectionItem item) {
- var machine = item as Machine;
-
- items_connections[item] = new ItemConnections (this, machine);
}
public void remove_item (CollectionItem item) {
}
+ 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);
@@ -177,6 +181,7 @@ private class Boxes.ListView: Gtk.ScrolledWindow, Boxes.ICollectionView, Boxes.U
window.select_item (item);
});
+ (list_box as Gtk.Container).add.connect (add_row);
(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]