diff options
Diffstat (limited to 'glib')
-rw-r--r-- | glib/test-dbus-glib.c | 4 | ||||
-rw-r--r-- | glib/test-profile.c | 2 | ||||
-rw-r--r-- | glib/test-thread-client.c | 2 | ||||
-rw-r--r-- | glib/test-thread-server.c | 27 |
4 files changed, 18 insertions, 17 deletions
diff --git a/glib/test-dbus-glib.c b/glib/test-dbus-glib.c index d963ee3d..d4b5f9b2 100644 --- a/glib/test-dbus-glib.c +++ b/glib/test-dbus-glib.c @@ -30,8 +30,8 @@ main (int argc, char **argv) dbus_connection_setup_with_g_main (connection, NULL); - message = dbus_message_new (DBUS_MESSAGE_HELLO, - DBUS_SERVICE_DBUS); + message = dbus_message_new_method_call (DBUS_MESSAGE_HELLO, + DBUS_SERVICE_DBUS); dbus_error_init (&error); reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error); diff --git a/glib/test-profile.c b/glib/test-profile.c index f213c676..6d13e32f 100644 --- a/glib/test-profile.c +++ b/glib/test-profile.c @@ -38,7 +38,7 @@ send_echo_message (DBusConnection *connection) { DBusMessage *message; - message = dbus_message_new (ECHO_MESSAGE, NULL); + message = dbus_message_new_method_call (ECHO_MESSAGE, NULL); dbus_message_append_args (message, DBUS_TYPE_STRING, "Hello World!", DBUS_TYPE_INT32, 123456, diff --git a/glib/test-thread-client.c b/glib/test-thread-client.c index 02ebdf67..a3290b27 100644 --- a/glib/test-thread-client.c +++ b/glib/test-thread-client.c @@ -19,7 +19,7 @@ thread_func (gpointer data) while (1) { - message = dbus_message_new ("org.freedesktop.ThreadTest", NULL); + message = dbus_message_new_method_call ("org.freedesktop.ThreadTest", NULL); dbus_message_append_iter_init (message, &iter); diff --git a/glib/test-thread-server.c b/glib/test-thread-server.c index 00044a79..4cc886fd 100644 --- a/glib/test-thread-server.c +++ b/glib/test-thread-server.c @@ -42,6 +42,9 @@ handle_test_message (DBusMessageHandler *handler, char *str, *expected_str; GString *counter_str; int i; + + if (!dbus_message_has_name (message, "org.freedesktop.ThreadTest")) + return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; dbus_message_iter_init (message, &iter); @@ -124,7 +127,7 @@ handle_test_message (DBusMessageHandler *handler, g_string_free (counter_str, TRUE); out: - return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; + return DBUS_HANDLER_RESULT_REMOVE_MESSAGE; } static DBusHandlerResult @@ -132,7 +135,7 @@ handle_filter (DBusMessageHandler *handler, DBusConnection *connection, DBusMessage *message, void *user_data) -{ +{ return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; } @@ -142,20 +145,20 @@ handle_disconnect (DBusMessageHandler *handler, DBusMessage *message, void *user_data) { + if (!dbus_message_has_name (message, DBUS_MESSAGE_LOCAL_DISCONNECT)) + return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; + g_print ("connection disconnected\n"); dbus_connection_unref (connection); - - return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; + + return DBUS_HANDLER_RESULT_REMOVE_MESSAGE; } - static void new_connection_callback (DBusServer *server, DBusConnection *new_connection, void *user_data) { - const char *test_messages[] = { "org.freedesktop.ThreadTest" }; - const char *disconnect_messages[] = { "org.freedesktop.Local.Disconnect" }; DBusMessageHandler *test_message_handler; ThreadTestData * data; @@ -170,9 +173,8 @@ new_connection_callback (DBusServer *server, dbus_message_handler_new (handle_test_message, data, (DBusFreeFunction)thread_test_data_free); - if (!dbus_connection_register_handler (new_connection, - test_message_handler, - test_messages, 1)) + if (!dbus_connection_add_filter (new_connection, + test_message_handler)) goto nomem; if (!dbus_connection_set_data (new_connection, @@ -181,9 +183,8 @@ new_connection_callback (DBusServer *server, (DBusFreeFunction)dbus_message_handler_unref)) goto nomem; - if (!dbus_connection_register_handler (new_connection, - disconnect_handler, - disconnect_messages, 1)) + if (!dbus_connection_add_filter (new_connection, + disconnect_handler)) goto nomem; if (!dbus_connection_add_filter (new_connection, |