[gnome-boxes/wip/props-ui-files: 5/12] props-page-widget: Add add_deferred_change()
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/props-ui-files: 5/12] props-page-widget: Add add_deferred_change()
- Date: Fri, 3 Jun 2016 13:43:14 +0000 (UTC)
commit 0fb10884c000b5372bb38a7a3a95d0eccf64e208
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Jun 1 20:08:31 2016 +0100
props-page-widget: Add add_deferred_change()
Add a method to add a deferred change to PropertiesPageWidget. This is
needed in preparation for dropping Property hierarchy in favor of new
PropertiesPageWidget hierarchy.
src/properties-page-widget.vala | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/properties-page-widget.vala b/src/properties-page-widget.vala
index 85f4049..357a431 100644
--- a/src/properties-page-widget.vala
+++ b/src/properties-page-widget.vala
@@ -6,10 +6,13 @@ private class Boxes.PropertiesPageWidget: Gtk.Box {
private Gtk.Grid grid;
private List<Boxes.Property> properties;
+ private List<DeferredChange> deferred_changes;
public signal void refresh_properties ();
public PropertiesPageWidget (PropertiesPage page, Machine machine) {
+ deferred_changes = new List<DeferredChange> ();
+
switch (page) {
case PropertiesPage.GENERAL:
name = _("General");
@@ -87,6 +90,29 @@ private class Boxes.PropertiesPageWidget: Gtk.Box {
reboot_required |= property.reboot_required;
}
+ foreach (var change in deferred_changes)
+ change.flush ();
+ deferred_changes = new List<DeferredChange> (); // FIXME: Better way to clear the list?
+
return reboot_required;
}
+
+ public void add_deferred_change (DeferredChange change) {
+ DeferredChange? deferred = null;
+
+ foreach (var c in deferred_changes) {
+ if (c.id == change.id) {
+ deferred = c;
+
+ break;
+ }
+ }
+
+ if (deferred != null) {
+ deferred.unschedule ();
+ deferred_changes.remove (deferred);
+ }
+
+ deferred_changes.append (change);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]