[gnome-boxes] Allow renaming remote machine
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Allow renaming remote machine
- Date: Wed, 2 Nov 2011 20:06:39 +0000 (UTC)
commit 1c15367e47577bda96b094fe7858ab616c11f757
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date: Wed Nov 2 18:36:23 2011 +0100
Allow renaming remote machine
src/collection-source.vala | 8 +++++++-
src/collection.vala | 2 +-
src/machine.vala | 1 +
src/properties.vala | 3 ++-
src/remote-machine.vala | 1 +
5 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/collection-source.vala b/src/collection-source.vala
index 4c5fe10..f65ec0d 100644
--- a/src/collection-source.vala
+++ b/src/collection-source.vala
@@ -4,7 +4,13 @@ private class Boxes.CollectionSource: GLib.Object {
private KeyFile keyfile;
public string? name {
owned get { return get_string ("source", "name"); }
- set { keyfile.set_string ("source", "name", value); }
+ set {
+ keyfile.set_string ("source", "name", value);
+ if (has_file)
+ FileUtils.unlink (get_pkgconfig_source (filename));
+ _filename = null;
+ save ();
+ }
}
public string? source_type {
owned get { return get_string ("source", "type"); }
diff --git a/src/collection.vala b/src/collection.vala
index 481281f..343c780 100644
--- a/src/collection.vala
+++ b/src/collection.vala
@@ -1,7 +1,7 @@
// This file is part of GNOME Boxes. License: LGPLv2+
private abstract class Boxes.CollectionItem: Boxes.UI {
- public string name;
+ public string name { set; get; }
}
private class Boxes.Collection: GLib.Object {
diff --git a/src/machine.vala b/src/machine.vala
index ff50035..1645229 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -251,6 +251,7 @@ private class Boxes.MachineActor: Boxes.UI {
gtk_vbox.get_widget ().get_style_context ().add_class ("boxes-bg");
label = new Gtk.Label (machine.name);
+ machine.bind_property ("name", label, "label", BindingFlags.DEFAULT);
vbox.add (label);
password_entry = new Gtk.Entry ();
password_entry.set_visibility (false);
diff --git a/src/properties.vala b/src/properties.vala
index 58786be..a22bb18 100644
--- a/src/properties.vala
+++ b/src/properties.vala
@@ -49,6 +49,7 @@ private class Boxes.Properties: Boxes.UI {
private Gtk.Label toolbar_label;
private Gtk.ListStore listmodel;
private Gtk.TreeView tree_view;
+ private GLib.Binding toolbar_label_bind;
private class PageWidget {
public Gtk.Widget widget;
@@ -202,7 +203,7 @@ private class Boxes.Properties: Boxes.UI {
public override void ui_state_changed () {
switch (ui_state) {
case UIState.PROPERTIES:
- toolbar_label.label = app.current_item.name;
+ toolbar_label_bind = app.current_item.bind_property ("name", toolbar_label, "label", BindingFlags.SYNC_CREATE);
populate ();
break;
}
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index b01f207..434c384 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -6,6 +6,7 @@ private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IProperties {
public RemoteMachine (CollectionSource source, Boxes.App app) {
base (source, app, source.name);
+ source.bind_property ("name", this, "name", BindingFlags.DEFAULT);
update_screenshot.begin ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]