[gnome-boxes] Properties: Avoid connecting to stats multiple times
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Properties: Avoid connecting to stats multiple times
- Date: Mon, 19 Nov 2012 10:01:04 +0000 (UTC)
commit eb9eed67b0aefa67c7af5f78c89c5665350c6230
Author: Alexander Larsson <alexl redhat com>
Date: Fri Nov 16 13:55:05 2012 +0100
Properties: Avoid connecting to stats multiple times
populate() can now be called multiple times, via the refresh_properties
signal. This moves the stats_updated call to ui_state_changed
so that it only happens once.
https://bugzilla.gnome.org/show_bug.cgi?id=688473
src/properties.vala | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/properties.vala b/src/properties.vala
index 96ae37b..3dade93 100644
--- a/src/properties.vala
+++ b/src/properties.vala
@@ -177,15 +177,9 @@ private class Boxes.Properties: Boxes.UI {
PropertiesPage current_page;
- if (libvirt_machine != null) {
- stats_id = libvirt_machine.stats_updated.connect (() => {
- cpu.points = libvirt_machine.cpu_stats;
- net.points = libvirt_machine.net_stats;
- io.points = libvirt_machine.io_stats;
- });
-
+ if (libvirt_machine != null)
current_page = (previous_ui_state == UIState.WIZARD) ? PropertiesPage.SYSTEM : PropertiesPage.LOGIN;
- } else
+ else
current_page = PropertiesPage.LOGIN;
var path = new Gtk.TreePath.from_indices (current_page);
@@ -303,6 +297,15 @@ private class Boxes.Properties: Boxes.UI {
switch (ui_state) {
case UIState.PROPERTIES:
+ if (App.app.current_item is LibvirtMachine) {
+ var libvirt_machine = App.app.current_item as LibvirtMachine;
+ stats_id = libvirt_machine.stats_updated.connect (() => {
+ cpu.points = libvirt_machine.cpu_stats;
+ net.points = libvirt_machine.net_stats;
+ io.points = libvirt_machine.io_stats;
+ });
+ }
+
toolbar_label_bind = null;
if (previous_ui_state != UIState.COLLECTION)
toolbar_label_bind = App.app.current_item.bind_property ("name", toolbar_label, "label", BindingFlags.SYNC_CREATE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]