diff options
-rw-r--r-- | client/dconf-client.vala | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/client/dconf-client.vala b/client/dconf-client.vala index d84f0c8..940abf2 100644 --- a/client/dconf-client.vala +++ b/client/dconf-client.vala @@ -8,18 +8,48 @@ namespace DConf { WatchFunc watch_func; Engine engine; + void got_signal (DBusConnection connection, string sender_name, string object_path, string interface_name, string signal_name, Variant parameters) { + unowned string path; + unowned string tag; + string[] items; + + if (signal_name == "Notify" && parameters.is_of_type ((VariantType) "(sass)")) { + VariantIter iter; + + parameters.get ("(&sas&s)", out path, out iter, out tag); + items = new string[iter.n_children ()]; + for (var i = 0; i < items.length; i++) { + iter.next ("s", out items[i]); + } + } else if (signal_name == "WritabilityNotify" && parameters.is_of_type ((VariantType) "(s)")) { + parameters.get ("(&s)", out path); + items = new string[0]; + tag = ""; + } else { + assert_not_reached (); + } + + watch_func (this, path, items, tag); + } + void call_sync (EngineMessage dcem, out string tag, Cancellable? cancellable) throws Error { DBusConnection connection; if (dcem.bus_types[0] == 'e') { if (session == null) { session = Bus.get_sync (BusType.SESSION, cancellable); + if (watch_func != null) { + session.signal_subscribe (null, "ca.desrt.dconf.Writer", null, null, null, DBusSignalFlags.NO_MATCH_RULE, got_signal); + } } connection = session; } else { assert (dcem.bus_types[0] == 'y'); if (system == null) { system = Bus.get_sync (BusType.SYSTEM, cancellable); + if (watch_func != null) { + system.signal_subscribe (null, "ca.desrt.dconf.Writer", null, null, null, DBusSignalFlags.NO_MATCH_RULE, got_signal); + } } connection = system; } |