summaryrefslogtreecommitdiff
path: root/systemadm.vala
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-05-16 04:31:42 +0200
committerLennart Poettering <lennart@poettering.net>2010-05-16 04:31:42 +0200
commited42e037bc93f8f6b54ee7b0b692c1200d2f4903 (patch)
tree0b787110c82d832d3ec1a02b306da7dde22c3f8a /systemadm.vala
parent949061f0d6f5ae8aecb5e1fc711f336e4ba48ca2 (diff)
systemadm: add UI for loading new units
Diffstat (limited to 'systemadm.vala')
-rw-r--r--systemadm.vala47
1 files changed, 46 insertions, 1 deletions
diff --git a/systemadm.vala b/systemadm.vala
index 6ea464f58d..b5985faf21 100644
--- a/systemadm.vala
+++ b/systemadm.vala
@@ -66,6 +66,9 @@ public class MainWindow : Window {
private Button reload_button;
private Button cancel_button;
+ private Entry unit_load_entry;
+ private Button unit_load_button;
+
private Button server_snapshot_button;
private Button server_reload_button;
@@ -126,7 +129,19 @@ public class MainWindow : Window {
unit_type_combo_box.set_active(1);
unit_type_combo_box.changed += unit_type_changed;
- server_snapshot_button = new Button.with_mnemonic("Take _Snapshot");
+ unit_load_entry = new Entry();
+ unit_load_button = new Button.with_mnemonic("_Load");
+ unit_load_button.set_sensitive(false);
+
+ unit_load_entry.changed += on_unit_load_entry_changed;
+ unit_load_entry.activate += on_unit_load;
+ unit_load_button.clicked += on_unit_load;
+
+ Gtk.Alignment unit_load_button_alignment = new Gtk.Alignment(0.5f, 0.5f, 1f, 1f);
+ unit_load_button_alignment.right_padding = 24;
+ unit_load_button_alignment.add(unit_load_button);
+
+ server_snapshot_button = new Button.with_mnemonic("Take S_napshot");
server_reload_button = new Button.with_mnemonic("Reload _Configuration");
server_snapshot_button.clicked += on_server_snapshot;
@@ -134,6 +149,8 @@ public class MainWindow : Window {
type_hbox.pack_end(server_snapshot_button, false, true, 0);
type_hbox.pack_end(server_reload_button, false, true, 0);
+ type_hbox.pack_end(unit_load_button_alignment, false, true, 0);
+ type_hbox.pack_end(unit_load_entry, false, true, 0);
unit_model = new ListStore(7, typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(Unit));
job_model = new ListStore(6, typeof(string), typeof(string), typeof(string), typeof(string), typeof(Job), typeof(uint32));
@@ -768,11 +785,39 @@ public class MainWindow : Window {
}
}
+ public void on_unit_load() {
+ try {
+ var path = manager.load_unit(unit_load_entry.get_text());
+
+ Unit u = bus.get_object(
+ "org.freedesktop.systemd1",
+ path,
+ "org.freedesktop.systemd1.Unit") as Unit;
+
+ var m = new MessageDialog(this,
+ DialogFlags.DESTROY_WITH_PARENT,
+ MessageType.INFO,
+ ButtonsType.CLOSE,
+ "Unit available as id %s", u.id);
+ m.title = "Unit";
+ m.run();
+ m.destroy();
+
+ } catch (DBus.Error e) {
+ show_error(e.message);
+ }
+ }
+
+ public void on_unit_load_entry_changed() {
+ unit_load_button.set_sensitive(unit_load_entry.get_text() != "");
+ }
+
public void show_error(string e) {
var m = new MessageDialog(this,
DialogFlags.DESTROY_WITH_PARENT,
MessageType.ERROR,
ButtonsType.CLOSE, "%s", e);
+ m.title = "Error";
m.run();
m.destroy();
}