diff options
author | Mike Gorse <mgorse@novell.com> | 2010-12-01 13:58:09 -0500 |
---|---|---|
committer | Mike Gorse <mgorse@novell.com> | 2010-12-01 13:58:09 -0500 |
commit | f422c2ec7bea75dcb0e1e1f7c30806b9e35a70a1 (patch) | |
tree | d45a16b7175b87937ce04a20fd39de8d548c53fe /dbind | |
parent | 7b4f66e271f2ce7d62228a4810c9e8dae7675598 (diff) | |
download | at-spi2-core-f422c2ec7bea75dcb0e1e1f7c30806b9e35a70a1.tar.gz |
Add time-out, and support inspecting our own app
Diffstat (limited to 'dbind')
-rw-r--r-- | dbind/dbind.c | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/dbind/dbind.c b/dbind/dbind.c index 294f6c1b..b090e069 100644 --- a/dbind/dbind.c +++ b/dbind/dbind.c @@ -18,9 +18,7 @@ static int dbind_timeout = -1; typedef struct _SpiReentrantCallClosure { - GMainLoop *loop; DBusMessage *reply; - guint timeout; } SpiReentrantCallClosure; static void @@ -29,15 +27,6 @@ set_reply (DBusPendingCall * pending, void *user_data) SpiReentrantCallClosure* closure = (SpiReentrantCallClosure *) user_data; closure->reply = dbus_pending_call_steal_reply (pending); - 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 * @@ -50,32 +39,19 @@ 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; + closure.reply = NULL; + dbus_connection_setup_with_g_main(bus, 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 + closure.reply = NULL; + while (!closure.reply) { - closure.reply = NULL; - while (!closure.reply) - { - if (!dbus_connection_read_write_dispatch (bus, dbind_timeout)) - return NULL; - } + if (!dbus_connection_read_write_dispatch (bus, dbind_timeout)) + return NULL; } - g_main_loop_unref (closure.loop); return closure.reply; } |