freeze break request: add org.a11y.Bus.IsEnabled

A while ago, Frederik Gladhorn proposed an API to check whether accessibility is enabled and also to toggle it on or off at runtime:

I would really like to implement the part of the proposal to check whether a11y is enabled; I ought to have done this sooner, but it slipped my mind, and I let API/feature freeze creep up on me. Historically, third-party apps have checked gconf to determine whether accessibility is enabled and to enable their own accessibility code. Unless it has been changed recently, Firefox is still doing this and so is inaccessible out of the box on a GNOME 3 system that was not created by upgrading a GNOME 2 system on which the user would have set the gconf key. I am also planning one more Mono Accessibility release to clean up/modernize a few things, and this needs to be updated there as well. Anyway, it seems preferable to have a way of checking whether accessibility is enabled that doesn't involve looking at a GSettings key, since other desktops (such as KDE ans XFCE) may support accessibility in the near future as well, and I would like for applications to be able to begin coding to it and have it function for GNOME 3.2 systems, so I really don't want this to have to wait for 3.4. I'm attaching a patch.

-Mike G-
diff --git a/src/BusObject.cs b/src/BusObject.cs
index 8106023..35693b5 100644
--- a/src/BusObject.cs
+++ b/src/BusObject.cs
@@ -13,6 +13,7 @@ namespace NDesk.DBus
 		protected Connection conn;
 		string bus_name;
+		string alt_bus_name;
 		ObjectPath object_path;
 		//protected BusObject ()
@@ -55,6 +56,7 @@ namespace NDesk.DBus
 			rule.Fields.Add (FieldCode.Interface, new MatchTest (iface));
 			rule.Fields.Add (FieldCode.Member, new MatchTest (member));
 			rule.Fields.Add (FieldCode.Path, new MatchTest (object_path));
+			rule.Fields.Add (FieldCode.Sender, new MatchTest (alt_bus_name != null? alt_bus_name: bus_name));
 			if (adding) {
 				if (conn.Handlers.ContainsKey (rule))
@@ -218,12 +220,16 @@ namespace NDesk.DBus
 			Message retMsg = conn.SendWithReplyAndBlock (callMsg);
+Console.WriteLine ("dbg: sender: " + retMsg.Header[FieldCode.Sender]);
 			MessageReader retVal = null;
 			//handle the reply message
 			switch (retMsg.Header.MessageType) {
 				case MessageType.MethodReturn:
+				if ((string)retMsg.Header[FieldCode.Sender] != bus_name)
+					alt_bus_name = (string)retMsg.Header[FieldCode.Sender];
+if ((string)retMsg.Header[FieldCode.Sender] != bus_name) Console.WriteLine ("dbg: new name--magic! " + bus_name + " -> " + alt_bus_name);
 					retVal = new MessageReader (retMsg);
 				case MessageType.Error:
diff --git a/src/Connection.cs b/src/Connection.cs
index 6a62647..7061b34 100644
--- a/src/Connection.cs
+++ b/src/Connection.cs
@@ -324,10 +324,13 @@ namespace NDesk.DBus
 			rule.MessageType = MessageType.Signal;
 			rule.Fields.Add (FieldCode.Interface, new MatchTest (signal.Interface));
 			rule.Fields.Add (FieldCode.Member, new MatchTest (signal.Member));
+			rule.Fields.Add (FieldCode.Sender, new MatchTest (signal.Sender));
+Console.WriteLine ("dbg: signal: " + signal.Member);
 			rule.Fields.Add (FieldCode.Path, new MatchTest (signal.Path));
 			Delegate dlg;
 			if (Handlers.TryGetValue (rule, out dlg) && dlg != null) {
+Console.WriteLine ("dbg: found");
 				MethodInfo mi = dlg.GetType ().GetMethod ("Invoke");
 				bool compatible = false;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]