diff options
author | Mike Gorse <mgorse@novell.com> | 2010-11-29 16:10:22 -0500 |
---|---|---|
committer | Mike Gorse <mgorse@novell.com> | 2010-11-29 18:45:56 -0500 |
commit | 702d6a97cf7ecae7cd58fe051a2ace197351a3a4 (patch) | |
tree | 2feb00aba3ccfd81e8b5eb920e7718013c81416c /dbind | |
parent | febc57fdd883c96a471a970f6801af9d5a5bdf92 (diff) | |
download | at-spi2-core-702d6a97cf7ecae7cd58fe051a2ace197351a3a4.tar.gz |
Various fixes
Events and DeviceEvents are now sent with transfer full to work around
a possible pygi bug.
Various other fixes.
Diffstat (limited to 'dbind')
-rw-r--r-- | dbind/dbind-any.c | 37 | ||||
-rw-r--r-- | dbind/dbind.c | 14 |
2 files changed, 50 insertions, 1 deletions
diff --git a/dbind/dbind-any.c b/dbind/dbind-any.c index 088a2076..083420df 100644 --- a/dbind/dbind-any.c +++ b/dbind/dbind-any.c @@ -630,6 +630,41 @@ dbind_any_demarshal (DBusMessageIter *iter, dbus_message_iter_next (iter); } +static const char * +pass_complex_arg (const char *p, char begin, char end) +{ + int level = 1; + + p++; + while (*p && level > 0) + { + if (*p == begin) + level++; + else if (*p == end) + level--; + p++; + } + if (*p == end) + p++; + return p; +} + +static const char * +pass_arg (const char *p) +{ + switch (*p) + { + case '(': + return pass_complex_arg (p, '(', ')'); + case '{': + return pass_complex_arg (p, '{', '}'); + case 'a': + return pass_arg (p+1); + default: + return p + 1; + } +} + /*---------------------------------------------------------------------------*/ void @@ -686,7 +721,7 @@ dbind_any_demarshal_va (DBusMessageIter *iter, fprintf (stderr, "Unknown / invalid arg type %c\n", *p); break; } - p++; + p = pass_arg (p); } if (p [0] == '=' && p[1] == '>') diff --git a/dbind/dbind.c b/dbind/dbind.c index a5da81d9..294f6c1b 100644 --- a/dbind/dbind.c +++ b/dbind/dbind.c @@ -20,6 +20,7 @@ typedef struct _SpiReentrantCallClosure { GMainLoop *loop; DBusMessage *reply; + guint timeout; } SpiReentrantCallClosure; static void @@ -31,6 +32,14 @@ set_reply (DBusPendingCall * pending, void *user_data) g_main_loop_quit (closure->loop); } +gboolean +main_loop_timeout (SpiReentrantCallClosure *closure) +{ + g_main_loop_quit (closure->loop); + /* Returning TRUE because caller will remove the timer */ + return TRUE; +} + DBusMessage * dbind_send_and_allow_reentry (DBusConnection * bus, DBusMessage * message, DBusError *error) { @@ -41,15 +50,20 @@ dbind_send_and_allow_reentry (DBusConnection * bus, DBusMessage * message, DBusE dbus_bus_get_unique_name (bus)) != 0) return dbus_connection_send_with_reply_and_block (bus, message, dbind_timeout, error); + /* TODO: Figure out why this isn't working */ + return NULL; if (!dbus_connection_send_with_reply (bus, message, &pending, dbind_timeout)) return NULL; dbus_pending_call_set_notify (pending, set_reply, (void *) &closure, NULL); closure.loop = g_main_loop_new (NULL, FALSE); + closure.reply = NULL; dbus_connection_setup_with_g_main(bus, NULL); if (1) { + closure.timeout = g_timeout_add_seconds (2, main_loop_timeout, &closure); g_main_loop_run (closure.loop); + g_source_remove (closure.timeout); } else { |