[at-spi2-atk] Change a : to a / in the suffix to an event



commit 024cd9555c052466010b8bae10c76851f5559d88
Author: Mike Gorse <mgorse novell com>
Date:   Wed Dec 14 21:14:27 2011 -0500

    Change a : to a / in the suffix to an event
    
    at-spi2-core now uses arg0path to create match rules to catch events
    with suffixes (ie, :system), but this is kind of stretching the intended
    purpose of arg*path, which expects paths delimited with /'s, so replace
    a : with a /. The / is changed back to a : in at-spi2-core.

 atk-adaptor/event.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/atk-adaptor/event.c b/atk-adaptor/event.c
index 586d196..61387b0 100644
--- a/atk-adaptor/event.c
+++ b/atk-adaptor/event.c
@@ -421,6 +421,18 @@ signal_is_needed (const gchar *klass, const gchar *major, const gchar *minor)
   return ret;
 }
 
+/* Convert a : to a / so that listeners can use arg0path to match only
+ *  * the prefix */
+static char *
+adapt_minor_for_dbus (char *source)
+{
+  gchar *ret = g_strdup (source);
+  int i = strcspn (ret, ":");
+  if (ret[i] == ':')
+    ret[i] = '/';
+  return ret;
+}
+
 /*
  * Emits an AT-SPI event.
  * AT-SPI events names are split into three parts:
@@ -444,6 +456,7 @@ emit_event (AtkObject  *obj,
 {
   DBusConnection *bus = spi_global_app_data->bus;
   const char *path;
+  char *minor_dbus;
 
   gchar *cname, *t;
   DBusMessage *sig;
@@ -469,7 +482,9 @@ emit_event (AtkObject  *obj,
 
   dbus_message_iter_init_append(sig, &iter);
 
-  dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &minor);
+  minor_dbus = adapt_minor_for_dbus (minor);
+  dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &minor_dbus);
+  g_free (minor_dbus);
   dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail1);
   dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &detail2);
   append_variant (&iter, type, val);



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