[gnome-boxes] Properties: Allow properties to specify extra widget
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Properties: Allow properties to specify extra widget
- Date: Wed, 31 Oct 2012 07:57:56 +0000 (UTC)
commit 8e9389bc9158743de263703a7d1a99c39eb2f31b
Author: Alexander Larsson <alexl redhat com>
Date: Tue Oct 30 20:08:20 2012 +0100
Properties: Allow properties to specify extra widget
This extra widget will be placed on the row below the label
and normal widget. Will be used for the ram/disk size
widgets in the new design.
https://bugzilla.gnome.org/show_bug.cgi?id=678123
src/i-properties-provider.vala | 9 +++++----
src/properties.vala | 9 +++++++++
2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/i-properties-provider.vala b/src/i-properties-provider.vala
index a471133..61484fe 100644
--- a/src/i-properties-provider.vala
+++ b/src/i-properties-provider.vala
@@ -4,6 +4,7 @@ using Gtk;
private class Boxes.Property: GLib.Object {
public string description { get; construct set; }
public Gtk.Widget widget { get; construct set; }
+ public Gtk.Widget? extra_widget { get; construct set; }
public bool reboot_required { get; set; }
public uint defer_interval { get; set; default = 1; } // In seconds
@@ -33,8 +34,8 @@ private class Boxes.Property: GLib.Object {
}
}
- public Property (string description, Gtk.Widget widget) {
- base (description: description, widget: widget);
+ public Property (string description, Gtk.Widget widget, Gtk.Widget? extra_widget) {
+ base (description: description, widget: widget, extra_widget: extra_widget);
}
public void flush () {
@@ -53,8 +54,8 @@ private delegate void PropertySizeChanged (Boxes.Property property, uint64 value
private interface Boxes.IPropertiesProvider: GLib.Object {
public abstract List<Boxes.Property> get_properties (Boxes.PropertiesPage page);
- protected Boxes.Property add_property (ref List<Boxes.Property> list, string name, Widget widget) {
- var property = new Property (name, widget);
+ 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);
list.append (property);
return property;
}
diff --git a/src/properties.vala b/src/properties.vala
index dba8744..d0d9b9f 100644
--- a/src/properties.vala
+++ b/src/properties.vala
@@ -110,6 +110,15 @@ private class Boxes.Properties: Boxes.UI {
var widget = property.widget;
widget.hexpand = true;
grid.attach (widget, 1, current_row, 1, 1);
+
+ widget = property.extra_widget;
+ if (widget != null) {
+ current_row += 1;
+ widget.margin_left = 25;
+ widget.hexpand = true;
+ grid.attach (widget, 0, current_row, 2, 1);
+ }
+
property.notify["reboot-required"].connect (update_infobar);
current_row += 1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]