59 lines
2.0 KiB
Plaintext
59 lines
2.0 KiB
Plaintext
$OpenBSD: patch-client_dconf-client_vala,v 1.2 2011/07/26 15:13:45 ajacoutot Exp $
|
|
|
|
From 70d1b330a7a09a555a1c66c17dc5111e08e77b8b Mon Sep 17 00:00:00 2001
|
|
From: Ryan Lortie <desrt@desrt.ca>
|
|
Date: Tue, 10 May 2011 10:16:20 +0000
|
|
Subject: Properly support watching in DConfClient
|
|
|
|
--- client/dconf-client.vala.orig Tue Jul 26 16:44:38 2011
|
|
+++ client/dconf-client.vala Tue Jul 26 17:06:04 2011
|
|
@@ -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;
|
|
}
|