[gnome-boxes] collection-view: Refactor Machine.info notify handler
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] collection-view: Refactor Machine.info notify handler
- Date: Sat, 29 Aug 2015 22:21:42 +0000 (UTC)
commit 2ff84ead04a225d7eee9706916d5a748db7afeef
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Fri Aug 28 18:29:57 2015 +0100
collection-view: Refactor Machine.info notify handler
Put code handling changes to Machine.info property, into a separate
function. In a following patch, we'll be launching the same function for
Machine.status change as well.
https://bugzilla.gnome.org/show_bug.cgi?id=753888
src/collection-view.vala | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/collection-view.vala b/src/collection-view.vala
index a72abb7..19a529d 100644
--- a/src/collection-view.vala
+++ b/src/collection-view.vala
@@ -167,11 +167,7 @@ private class Boxes.CollectionView: Gd.MainView, Boxes.ICollectionView, Boxes.UI
});
item.set_data<ulong> ("name_id", name_id);
- var info_id = machine.notify["info"].connect (() => {
- // apparently iter is stable after insertion/removal/sort
- store.set (iter, ModelColumns.INFO, machine.info);
- queue_draw ();
- });
+ var info_id = machine.notify["info"].connect (on_machine_info_changed);
item.set_data<ulong> ("info_id", info_id);
setup_activity (iter, machine);
@@ -431,4 +427,13 @@ private class Boxes.CollectionView: Gd.MainView, Boxes.ICollectionView, Boxes.UI
return true;
}
+
+ private void on_machine_info_changed (GLib.Object object, GLib.ParamSpec spec) {
+ var machine = object as Machine;
+ var iter = machine.get_data<Gtk.TreeIter?> ("iter");
+ return_if_fail (iter != null);
+
+ store.set (iter, ModelColumns.INFO, machine.info);
+ queue_draw ();
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]