[gnome-boxes] Add machine local var



commit 660314e4b9cb8639f8864a0ff58b13b2af4c507c
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Oct 25 16:55:46 2012 +0200

    Add machine local var
    
    This is resued twice and will be used more
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686775

 src/properties.vala |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/properties.vala b/src/properties.vala
index 3355ab7..6be1256 100644
--- a/src/properties.vala
+++ b/src/properties.vala
@@ -141,11 +141,12 @@ private class Boxes.Properties: Boxes.UI {
         for (var i = 0; i < PropertiesPage.LAST; i++)
             notebook.remove_page (-1);
 
-        if (App.app.current_item == null)
+        var machine = App.app.current_item as Machine;
+
+        if (machine == null)
             return;
 
         for (var i = 0; i < PropertiesPage.LAST; i++) {
-            var machine = App.app.current_item as Machine;
             var page = new PageWidget (i, machine);
             notebook.append_page (page.widget, null);
             notebook.set_data<PageWidget> (@"boxes-property-$i", page);
@@ -156,7 +157,7 @@ private class Boxes.Properties: Boxes.UI {
 
         PropertiesPage current_page;
 
-        var libvirt_machine = App.app.current_item as LibvirtMachine;
+        var libvirt_machine = machine as LibvirtMachine;
         if (libvirt_machine != null) {
             stats_id = libvirt_machine.stats_updated.connect (() => {
                 cpu.points = libvirt_machine.cpu_stats;



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