[gnome-boxes] Allow properties to request a refresh of the properties



commit 811adbdbbf433ff9ef433ae3057f8921f35d824c
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Nov 6 10:06:43 2012 +0100

    Allow properties to request a refresh of the properties
    
    This is useful is changing a property may cause a change in the
    set of availible properties.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672268

 src/i-properties-provider.vala |    2 ++
 src/properties.vala            |   13 +++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/i-properties-provider.vala b/src/i-properties-provider.vala
index a9a0925..2cb1e9e 100644
--- a/src/i-properties-provider.vala
+++ b/src/i-properties-provider.vala
@@ -7,6 +7,8 @@ private class Boxes.Property: GLib.Object {
     public Gtk.Widget? extra_widget { get; construct set; }
     public bool reboot_required { get; set; }
 
+    public signal void refresh_properties ();
+
     public uint defer_interval { get; set; default = 1; } // In seconds
 
     private uint deferred_change_id;
diff --git a/src/properties.vala b/src/properties.vala
index 1ed455c..96ae37b 100644
--- a/src/properties.vala
+++ b/src/properties.vala
@@ -37,6 +37,8 @@ private class Boxes.Properties: Boxes.UI {
         private Gtk.InfoBar infobar;
         private List<Boxes.Property> properties;
 
+        public signal void refresh_properties ();
+
         public void update_infobar () {
             var show_it = false;
             foreach (var property in properties) {
@@ -113,6 +115,9 @@ private class Boxes.Properties: Boxes.UI {
                     }
 
                     property.notify["reboot-required"].connect (update_infobar);
+                    property.refresh_properties.connect (() => {
+                        this.refresh_properties ();
+                     });
                     current_row += 1;
                 }
 
@@ -159,6 +164,14 @@ private class Boxes.Properties: Boxes.UI {
             notebook.append_page (page.widget, null);
             notebook.set_data<PageWidget> (@"boxes-property-$i", page);
 
+            page.refresh_properties.connect (() => {
+                var current_page = notebook.page;
+                this.populate ();
+                var path = new Gtk.TreePath.from_indices (current_page);
+                tree_view.get_selection ().select_path (path);
+                notebook.page = current_page;
+            });
+
             list_append (listmodel, page.name, !page.empty);
         }
 



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