summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2011-03-03 20:54:01 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2011-09-20 01:06:01 +0200
commit11216eb0bd5aab6b14af004fd2f24d423e3d356d (patch)
tree429cd37a7881e334efee5f4567225a3073a2f6ed /src
parent0dd27daff4ba4bdad99b12b85b630ab21c84fa9e (diff)
systemadm: add libgee as dependency and use it for a unit map
Diffstat (limited to 'src')
-rw-r--r--src/systemadm.vala14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/systemadm.vala b/src/systemadm.vala
index 68652d0064..c893da01da 100644
--- a/src/systemadm.vala
+++ b/src/systemadm.vala
@@ -79,6 +79,8 @@ public class MainWindow : Window {
private ListStore unit_model;
private ListStore job_model;
+ private Gee.HashMap<string, Unit> unit_map;
+
private Button start_button;
private Button stop_button;
private Button restart_button;
@@ -180,6 +182,8 @@ public class MainWindow : Window {
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));
+ unit_map = new Gee.HashMap<string, Unit>();
+
TreeModelFilter unit_model_filter;
unit_model_filter = new TreeModelFilter(unit_model, null);
unit_model_filter.set_visible_func(unit_filter);
@@ -355,6 +359,8 @@ public class MainWindow : Window {
"org.freedesktop.systemd1",
i.unit_path);
+ unit_map[i.id] = u;
+
unit_model.append(out iter);
unit_model.set(iter,
0, i.id,
@@ -415,6 +421,10 @@ public class MainWindow : Window {
return u;
}
+ public Unit? get_unit(string id) {
+ return this.unit_map[id];
+ }
+
public void unit_changed() {
Unit u = get_current_unit();
@@ -712,6 +722,8 @@ public class MainWindow : Window {
"org.freedesktop.systemd1",
path);
+ unit_map[id] = u;
+
update_unit_iter(iter, id, u);
} catch (IOError e) {
show_error(e.message);
@@ -773,6 +785,8 @@ public class MainWindow : Window {
}
} while (unit_model.iter_next(ref iter));
+
+ unit_map.unset(id);
}
public void on_job_removed(uint32 id, ObjectPath path, string res) {