dbus/test/glib test-service-glib.c,1.9,1.10
Colin Walters
walters at freedesktop.org
Thu Mar 17 09:12:01 PST 2005
Update of /cvs/dbus/dbus/test/glib
In directory gabe:/tmp/cvs-serv28471/test/glib
Modified Files:
test-service-glib.c
Log Message:
2005-03-14 Colin Walters <walters at verbum.org>
* bus/driver.c (write_args_for_direction): Use
_dbus_string_get_const_data to retrieve string;
_dbus_string_get_const_data_len doesn't actually return
a NULL-terminated substring.
* test/glib/test-service-glib.c: Include dbus-glib-bindings.h.
(main): Change to use org_freedesktop_DBus_request_name
instead of using g_proxy_begin_call/end_call.
Index: test-service-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-service-glib.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- test-service-glib.c 17 Feb 2005 21:19:48 -0000 1.9
+++ test-service-glib.c 17 Mar 2005 17:11:59 -0000 1.10
@@ -1,5 +1,9 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
#include <dbus/dbus-glib.h>
+/* NOTE - outside of D-BUS core this would be
+ * include <dbus/dbus-glib-bindings.h>
+ */
+#include "glib/dbus-glib-bindings.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -190,6 +194,8 @@
static GMainLoop *loop;
+#define TEST_SERVICE_NAME "org.freedesktop.DBus.TestSuiteGLibService"
+
int
main (int argc, char **argv)
{
@@ -197,9 +203,7 @@
GError *error;
GObject *obj;
DBusGProxy *driver_proxy;
- DBusGPendingCall *call;
- const char *v_STRING;
- guint32 v_UINT32;
+ guint32 request_name_ret;
g_type_init ();
@@ -231,34 +235,24 @@
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS);
- v_STRING = "org.freedesktop.DBus.TestSuiteGLibService";
- v_UINT32 = 0;
- call = dbus_g_proxy_begin_call (driver_proxy, "RequestName",
- DBUS_TYPE_STRING,
- &v_STRING,
- DBUS_TYPE_UINT32,
- &v_UINT32,
- DBUS_TYPE_INVALID);
- if (!dbus_g_proxy_end_call (driver_proxy, call,
- &error, DBUS_TYPE_UINT32, &v_UINT32,
- DBUS_TYPE_INVALID))
+ if (!org_freedesktop_DBus_request_name (driver_proxy,
+ TEST_SERVICE_NAME,
+ 0, &request_name_ret, &error))
{
g_assert (error != NULL);
g_printerr ("Failed to get name: %s\n",
- error->message);
- g_error_free (error);
+ error->message);
+ g_clear_error (&error);
exit (1);
}
- g_assert (error == NULL);
- dbus_g_pending_call_unref (call);
- if (!(v_UINT32 == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER))
+ if (!(request_name_ret == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER))
{
- g_printerr ("Got result code %u from requesting name\n", v_UINT32);
+ g_printerr ("Got result code %u from requesting name\n", request_name_ret);
exit (1);
}
- g_printerr ("GLib test service has name '%s'\n", v_STRING);
+ g_printerr ("GLib test service has name '%s'\n", TEST_SERVICE_NAME);
g_printerr ("GLib test service entering main loop\n");
g_main_loop_run (loop);
More information about the dbus-commit
mailing list