+
+ public void on_unit_new(string id, ObjectPath path) {
+ stderr.printf("new path %s", path);
+
+ Unit u = bus.get_object(
+ "org.freedesktop.systemd1",
+ path,
+ "org.freedesktop.systemd1.Unit") as Unit;
+
+ string t = "";
+ Unit.JobLink jl = u.job;
+
+ if (jl.id != 0) {
+ Job j = bus.get_object(
+ "org.freedesktop.systemd1",
+ jl.path,
+ "org.freedesktop.systemd1.Job") as Job;
+
+ t = j.job_type;
+ }
+
+ TreeIter iter;
+ unit_model.append(out iter);
+ unit_model.set(iter,
+ 0, u.id,
+ 1, u.description,
+ 2, u.load_state,
+ 3, u.active_state,
+ 4, t != "" ? "→ %s".printf(t) : "",
+ 5, u);
+ }
+
+ public void on_job_new(uint32 id, ObjectPath path) {
+ stderr.printf("new path %s", path);
+
+ Job j = bus.get_object(
+ "org.freedesktop.systemd1",
+ path,
+ "org.freedesktop.systemd1.Job") as Job;
+
+ TreeIter iter;
+ job_model.append(out iter);
+ job_model.set(iter,
+ 0, "%u".printf(j.id),
+ 1, j.unit.id,
+ 2, "→ %s".printf(j.job_type),
+ 3, j.state,
+ 4, j);
+ }
+
+ public void on_unit_removed(string id, ObjectPath path) {
+ stdout.printf("Unit %s removed.\n", id);
+
+ /* FIXME */
+ }
+
+ public void on_job_removed(uint32 id, ObjectPath path) {
+ stdout.printf("Job %u removed.\n", id);
+
+ /* FIXME */
+ }