From 5c4c4143a5ea25ec408304fdc7463709163ff9a7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 7 Jan 2010 08:55:35 -0600 Subject: Removing the half second timeout as it's no longer needed. --- tests/test-glib-layout-client.c | 4 +--- tests/test-glib-layout-server.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/test-glib-layout-client.c b/tests/test-glib-layout-client.c index a7dd683..bb2d13a 100644 --- a/tests/test-glib-layout-client.c +++ b/tests/test-glib-layout-client.c @@ -109,9 +109,7 @@ main (int argc, char ** argv) { g_type_init(); - g_usleep(500000); - - DbusmenuClient * client = dbusmenu_client_new(":1.0", "/org/test"); + DbusmenuClient * client = dbusmenu_client_new("org.dbusmenu.test", "/org/test"); g_signal_connect(G_OBJECT(client), DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED, G_CALLBACK(layout_updated), NULL); g_timeout_add_seconds(10, timer_func, client); diff --git a/tests/test-glib-layout-server.c b/tests/test-glib-layout-server.c index cc9b8e7..40dd048 100644 --- a/tests/test-glib-layout-server.c +++ b/tests/test-glib-layout-server.c @@ -24,6 +24,7 @@ with this program. If not, see . #include #include #include +#include #include #include @@ -74,10 +75,26 @@ timer_func (gpointer data) int main (int argc, char ** argv) { + GError * error = NULL; + g_type_init(); + DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); + DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); + guint nameret = 0; + + if (!org_freedesktop_DBus_request_name(bus_proxy, "org.dbusmenu.test", 0, &nameret, &error)) { + g_error("Unable to call to request name"); + return 1; + } + + if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { + g_error("Unable to get name"); + return 1; + } + server = dbusmenu_server_new("/org/test"); timer_func(NULL); -- cgit v1.2.3