[gnome-boxes/wip/props-ui-files: 86/96] props-page-widget: Add add_string_property()
- From: Zeeshan Ali <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/props-ui-files: 86/96] props-page-widget: Add add_string_property()
- Date: Sat, 26 Nov 2016 16:44:04 +0000 (UTC)
commit 3e84d55a0091342eaafa96b375e2f568f5afbe1f
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Jun 1 21:13:24 2016 +0100
props-page-widget: Add add_string_property()
Add a method that adds a string property. Like the previous patches, this
ignores the Property hierarchy intentionally to allow for smooth
transition from Property hierarchy to (yet to be created)
PropertiesPageWidget hierarchy
src/properties-page-widget.vala | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/properties-page-widget.vala b/src/properties-page-widget.vala
index acd05ca..82e19c0 100644
--- a/src/properties-page-widget.vala
+++ b/src/properties-page-widget.vala
@@ -12,6 +12,7 @@ private class Boxes.PropertiesPageWidget: Gtk.Box {
public signal void refresh_properties ();
public delegate void SizePropertyChanged (PropertiesPageWidget widget, uint64 value);
+ public delegate void StringPropertyChanged (PropertiesPageWidget widget, string value);
private int num_rows = 0;
@@ -207,4 +208,24 @@ private class Boxes.PropertiesPageWidget: Gtk.Box {
return box;
}
+
+ public void add_string_property (string name, string value, StringPropertyChanged? changed = null) {
+ if (changed != null) {
+ var entry = new Gtk.Entry ();
+
+ add_property (name, entry, null);
+
+ entry.text = value;
+
+ entry.notify["text"].connect (() => {
+ changed (this, entry.text);
+ });
+ } else {
+ var label = new Gtk.Label (value);
+ label.halign = Gtk.Align.START;
+ label.selectable = true;
+
+ add_property (name, label, null);
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]