[gnome-boxes] Use ref for IPropertyProvider::get_properties 'flag' arg



commit 28148f6f92bd0558cddda2c037043bb86069f39b
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Tue Mar 5 15:08:06 2013 +0100

    Use ref for IPropertyProvider::get_properties 'flag' arg
    
    It seems this is what LibvirtMachineProperties::get_properties()
    expects as it is modifying its 'flag' argument to indicate USB support
    is missing.
    SpiceDisplay::get_properties() is then checking for the presence
    of this flag, and hides the list of USB devices if the box
    does not have USB redirection support.
    
    However, without using 'ref' on the get_properties 'flag' argument,
    the change made in LibvirtMachineProperties won't get propagated
    to the caller (this is LibvirtMachine::get_properties), and then
    SpiceDisplay::get_properties will get unmodified flags and won't
    know it should disable USB support.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695207

 src/display.vala                    |    2 +-
 src/i-properties-provider.vala      |    2 +-
 src/libvirt-machine-properties.vala |    2 +-
 src/libvirt-machine.vala            |    6 +++---
 src/machine.vala                    |    2 +-
 src/ovirt-machine.vala              |    4 ++--
 src/properties.vala                 |    3 ++-
 src/remote-machine.vala             |    4 ++--
 src/spice-display.vala              |    2 +-
 src/vnc-display.vala                |    2 +-
 10 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/src/display.vala b/src/display.vala
index 1e8bfd4..03b16a4 100644
--- a/src/display.vala
+++ b/src/display.vala
@@ -33,7 +33,7 @@ private abstract class Boxes.Display: GLib.Object, Boxes.IPropertiesProvider {
     public virtual void collect_logs (StringBuilder builder) {
     }
 
-    public abstract List<Boxes.Property> get_properties (Boxes.PropertiesPage page, PropertyCreationFlag 
flags);
+    public abstract List<Boxes.Property> get_properties (Boxes.PropertiesPage page, ref PropertyCreationFlag 
flags);
 
     protected HashTable<int, Gtk.Widget?> displays;
 
diff --git a/src/i-properties-provider.vala b/src/i-properties-provider.vala
index 6b794ab..81bf3be 100644
--- a/src/i-properties-provider.vala
+++ b/src/i-properties-provider.vala
@@ -139,7 +139,7 @@ public enum PropertyCreationFlag {
 }
 
 private interface Boxes.IPropertiesProvider: GLib.Object {
-    public abstract List<Boxes.Property> get_properties (Boxes.PropertiesPage page, PropertyCreationFlag 
flags);
+    public abstract List<Boxes.Property> get_properties (Boxes.PropertiesPage page, ref PropertyCreationFlag 
flags);
 
     protected Boxes.Property add_property (ref List<Boxes.Property> list, string? name, Widget widget, 
Widget? extra_widget = null) {
         var property = new Property (name, widget, extra_widget);
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index 275b14d..d957529 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -102,7 +102,7 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
         return builder.str;
     }
 
-    public List<Boxes.Property> get_properties (Boxes.PropertiesPage page, PropertyCreationFlag flags) {
+    public List<Boxes.Property> get_properties (Boxes.PropertiesPage page, ref PropertyCreationFlag flags) {
         var list = new List<Boxes.Property> ();
 
         // the wizard may want to modify display properties, before connect_display()
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index 1a5b4f7..5e64b97 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -293,12 +293,12 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
         }
     }
 
-    public override List<Boxes.Property> get_properties (Boxes.PropertiesPage page, PropertyCreationFlag 
flags) {
-        var list = properties.get_properties (page, flags);
+    public override List<Boxes.Property> get_properties (Boxes.PropertiesPage page, ref PropertyCreationFlag 
flags) {
+        var list = properties.get_properties (page, ref flags);
 
         if (display != null)
             list.concat (display.get_properties (page,
-                                                 flags));
+                                                 ref flags));
 
         return list;
     }
diff --git a/src/machine.vala b/src/machine.vala
index 85c1b3a..d616e56 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -255,7 +255,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
         return display.get_pixbuf (0);
     }
 
-    public abstract List<Boxes.Property> get_properties (Boxes.PropertiesPage page, PropertyCreationFlag 
flags);
+    public abstract List<Boxes.Property> get_properties (Boxes.PropertiesPage page, ref PropertyCreationFlag 
flags);
 
     public abstract async void connect_display (ConnectFlags flags) throws GLib.Error;
 
diff --git a/src/ovirt-machine.vala b/src/ovirt-machine.vala
index 2b95ca7..9ed536b 100644
--- a/src/ovirt-machine.vala
+++ b/src/ovirt-machine.vala
@@ -50,7 +50,7 @@ private class Boxes.OvirtMachine: Boxes.Machine {
         }
     }
 
-    public override List<Boxes.Property> get_properties (Boxes.PropertiesPage page, PropertyCreationFlag 
flags) {
+    public override List<Boxes.Property> get_properties (Boxes.PropertiesPage page, ref PropertyCreationFlag 
flags) {
         var list = new List<Boxes.Property> ();
 
         switch (page) {
@@ -64,7 +64,7 @@ private class Boxes.OvirtMachine: Boxes.Machine {
             break;
         }
 
-        list.concat (display.get_properties (page, flags));
+        list.concat (display.get_properties (page, ref flags));
 
         return list;
     }
diff --git a/src/properties.vala b/src/properties.vala
index c86f4bc..b52efe9 100644
--- a/src/properties.vala
+++ b/src/properties.vala
@@ -98,7 +98,8 @@ private class Boxes.Properties: Boxes.UI {
             infobar.hexpand = true;
             grid.attach (infobar, 0, 0, 2, 1);
 
-            properties = machine.get_properties (page, PropertyCreationFlag.NONE);
+            PropertyCreationFlag flags = PropertyCreationFlag.NONE;
+            properties = machine.get_properties (page, ref flags);
             empty = properties.length () == 0;
             if (!empty) {
                 int current_row = 1;
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index 06018eb..e89541a 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -44,7 +44,7 @@ private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
         }
     }
 
-    public override List<Boxes.Property> get_properties (Boxes.PropertiesPage page, PropertyCreationFlag 
flags) {
+    public override List<Boxes.Property> get_properties (Boxes.PropertiesPage page, ref PropertyCreationFlag 
flags) {
         var list = new List<Boxes.Property> ();
 
         switch (page) {
@@ -67,7 +67,7 @@ private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
             if (display == null)
                 display = create_display ();
 
-            list.concat (display.get_properties (page, flags));
+            list.concat (display.get_properties (page, ref flags));
         } catch (Boxes.Error error) {
             warning (error.message);
         }
diff --git a/src/spice-display.vala b/src/spice-display.vala
index 161ac7b..5e58581 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -261,7 +261,7 @@ private class Boxes.SpiceDisplay: Boxes.Display {
         }
     }
 
-    public override List<Boxes.Property> get_properties (Boxes.PropertiesPage page, PropertyCreationFlag 
flags) {
+    public override List<Boxes.Property> get_properties (Boxes.PropertiesPage page, ref PropertyCreationFlag 
flags) {
         var list = new List<Boxes.Property> ();
 
         switch (page) {
diff --git a/src/vnc-display.vala b/src/vnc-display.vala
index fce77a8..ee6b4dd 100644
--- a/src/vnc-display.vala
+++ b/src/vnc-display.vala
@@ -134,7 +134,7 @@ private class Boxes.VncDisplay: Boxes.Display {
             display.close ();
     }
 
-    public override List<Boxes.Property> get_properties (Boxes.PropertiesPage page, PropertyCreationFlag 
flags) {
+    public override List<Boxes.Property> get_properties (Boxes.PropertiesPage page, ref PropertyCreationFlag 
flags) {
         var list = new List<Boxes.Property> ();
 
         switch (page) {


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