diff options
Diffstat (limited to 'src/systemadm.vala')
-rw-r--r-- | src/systemadm.vala | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/src/systemadm.vala b/src/systemadm.vala index 3610e2b8f4..4aee1d35e6 100644 --- a/src/systemadm.vala +++ b/src/systemadm.vala @@ -325,13 +325,19 @@ public class MainWindow : Window { foreach (var i in list) { TreeIter iter; + Properties p = bus.get_object( + "org.freedesktop.systemd1", + i.unit_path, + "org.freedesktop.DBus.Properties") as Properties; + + + p.properties_changed.connect(on_unit_changed); + Unit u = bus.get_object( "org.freedesktop.systemd1", i.unit_path, "org.freedesktop.systemd1.Unit") as Unit; - u.changed.connect(on_unit_changed); - unit_model.append(out iter); unit_model.set(iter, 0, i.id, @@ -352,13 +358,18 @@ public class MainWindow : Window { foreach (var i in list) { TreeIter iter; + Properties p = bus.get_object( + "org.freedesktop.systemd1", + i.job_path, + "org.freedesktop.DBus.Properties") as Properties; + + p.properties_changed.connect(on_job_changed); + Job j = bus.get_object( "org.freedesktop.systemd1", i.job_path, "org.freedesktop.systemd1.Job") as Job; - j.changed.connect(on_job_changed); - job_model.append(out iter); job_model.set(iter, 0, "%u".printf(i.id), @@ -672,15 +683,21 @@ public class MainWindow : Window { } public void on_unit_new(string id, ObjectPath path) { - Unit u = bus.get_object( + Properties p = bus.get_object( "org.freedesktop.systemd1", path, - "org.freedesktop.systemd1.Unit") as Unit; + "org.freedesktop.DBus.Properties") as Properties; - u.changed.connect(on_unit_changed); + p.properties_changed.connect(on_unit_changed); TreeIter iter; unit_model.append(out iter); + + Unit u = bus.get_object( + "org.freedesktop.systemd1", + path, + "org.freedesktop.systemd1.Unit") as Unit; + update_unit_iter(iter, id, u); } @@ -695,15 +712,22 @@ public class MainWindow : Window { } public void on_job_new(uint32 id, ObjectPath path) { - Job j = bus.get_object( + + Properties p = bus.get_object( "org.freedesktop.systemd1", path, - "org.freedesktop.systemd1.Job") as Job; + "org.freedesktop.DBus.Properties") as Properties; - j.changed.connect(on_job_changed); + p.properties_changed.connect(on_job_changed); TreeIter iter; job_model.append(out iter); + + Job j = bus.get_object( + "org.freedesktop.systemd1", + path, + "org.freedesktop.systemd1.Job") as Job; + update_job_iter(iter, id, j); } @@ -750,10 +774,15 @@ public class MainWindow : Window { } while (job_model.iter_next(ref iter)); } - public void on_unit_changed(Unit u) { + public void on_unit_changed(Properties p, string iface, HashTable<string, Value?> changed_properties, string[] invalidated_properties) { TreeIter iter; string id; + Unit u = bus.get_object( + p.get_bus_name(), + p.get_path(), + "org.freedesktop.systemd1.Unit") as Unit; + if (!(unit_model.get_iter_first(out iter))) return; @@ -776,10 +805,15 @@ public class MainWindow : Window { } while (unit_model.iter_next(ref iter)); } - public void on_job_changed(Job j) { + public void on_job_changed(Properties p, string iface, HashTable<string, Value?> changed_properties, string[] invalidated_properties) { TreeIter iter; uint32 id; + Job j = bus.get_object( + p.get_bus_name(), + p.get_path(), + "org.freedesktop.systemd1.Job") as Job; + if (!(job_model.get_iter_first(out iter))) return; |