[gnome-boxes] Clean-up IProperties interface a bit
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Clean-up IProperties interface a bit
- Date: Mon, 2 Jan 2012 21:13:37 +0000 (UTC)
commit 8a767e8699cb442eb350ed62f0303b6e9fe78440
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Jan 2 17:52:20 2012 +0200
Clean-up IProperties interface a bit
- Rename to IPropertiesProvider.
- Put into separate vala file.
https://bugzilla.gnome.org/show_bug.cgi?id=667140
src/Makefile.am | 1 +
src/display.vala | 2 +-
src/i-properties-provider.vala | 34 ++++++++++++++++++++++++++++++++++
src/machine.vala | 2 +-
src/properties.vala | 30 ------------------------------
src/remote-machine.vala | 2 +-
src/spice-display.vala | 2 +-
7 files changed, 39 insertions(+), 34 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 9f203cc..d18c625 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -47,6 +47,7 @@ gnome_boxes_SOURCES = \
mini-graph.vala \
main.vala \
os-database.vala \
+ i-properties-provider.vala \
properties.vala \
remote-machine.vala \
selectionbar.vala \
diff --git a/src/display.vala b/src/display.vala
index ea50d0f..8581475 100644
--- a/src/display.vala
+++ b/src/display.vala
@@ -1,7 +1,7 @@
// This file is part of GNOME Boxes. License: LGPLv2+
using Gtk;
-private abstract class Boxes.Display: GLib.Object, Boxes.IProperties {
+private abstract class Boxes.Display: GLib.Object, Boxes.IPropertiesProvider {
protected struct SavedProperty {
string name;
Value default_value;
diff --git a/src/i-properties-provider.vala b/src/i-properties-provider.vala
new file mode 100644
index 0000000..84eb7d4
--- /dev/null
+++ b/src/i-properties-provider.vala
@@ -0,0 +1,34 @@
+// This file is part of GNOME Boxes. License: LGPLv2+
+using Gtk;
+
+public delegate void PropertyStringChanged (string value) throws Boxes.Error;
+
+private interface Boxes.IPropertiesProvider: GLib.Object {
+ public abstract List<Pair<string, Widget>> get_properties (Boxes.PropertiesPage page);
+
+ protected void add_property (ref List<Pair<string, Widget>> list, string name, Widget widget) {
+ list.append (new Pair<string, Widget> (name, widget));
+ }
+
+ protected void add_string_property (ref List<Pair<string, Widget>> list,
+ string name,
+ string value,
+ PropertyStringChanged? changed = null) {
+ var entry = new Boxes.EditableEntry ();
+
+ entry.text = value;
+ entry.selectable = true;
+ entry.editable = changed != null;
+
+ entry.editing_done.connect (() => {
+ try {
+ changed (entry.text);
+ } catch (Boxes.Error error) {
+ warning (error.message);
+ }
+ });
+
+ add_property (ref list, name, entry);
+ }
+}
+
diff --git a/src/machine.vala b/src/machine.vala
index 63626da..6eee8e1 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -3,7 +3,7 @@ using Clutter;
using Gdk;
using Gtk;
-private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IProperties {
+private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesProvider {
public override Clutter.Actor actor { get { return machine_actor.actor; } }
public Boxes.App app;
public MachineActor machine_actor;
diff --git a/src/properties.vala b/src/properties.vala
index 5ae240f..75aa148 100644
--- a/src/properties.vala
+++ b/src/properties.vala
@@ -9,36 +9,6 @@ private enum Boxes.PropertiesPage {
LAST,
}
-public delegate void PropertyStringChanged (string value) throws Boxes.Error;
-
-private interface Boxes.IProperties: GLib.Object {
- public abstract List<Pair<string, Widget>> get_properties (Boxes.PropertiesPage page);
-
- protected void add_property (ref List<Pair<string, Widget>> list, string name, Widget widget) {
- list.append (new Pair<string, Widget> (name, widget));
- }
-
- protected void add_string_property (ref List<Pair<string, Widget>> list,
- string name, string value,
- PropertyStringChanged? changed = null) {
- var entry = new Boxes.EditableEntry ();
-
- entry.text = value;
- entry.selectable = true;
- entry.editable = changed != null;
-
- entry.editing_done.connect (() => {
- try {
- changed (entry.text);
- } catch (Boxes.Error error) {
- warning (error.message);
- }
- });
-
- add_property (ref list, name, entry);
- }
-}
-
private class Boxes.Properties: Boxes.UI {
public override Clutter.Actor actor { get { return gtk_actor; } }
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index fef2684..25493dd 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -1,7 +1,7 @@
// This file is part of GNOME Boxes. License: LGPLv2+
using Gtk;
-private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IProperties {
+private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
public RemoteMachine (CollectionSource source, Boxes.App app) {
base (source, app, source.name);
diff --git a/src/spice-display.vala b/src/spice-display.vala
index c3a7bd7..e36f6ca 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -2,7 +2,7 @@
using Gtk;
using Spice;
-private class Boxes.SpiceDisplay: Boxes.Display, Boxes.IProperties {
+private class Boxes.SpiceDisplay: Boxes.Display, Boxes.IPropertiesProvider {
public override string protocol { get { return "SPICE"; } }
public override string uri { owned get { return session.uri; } }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]