gdbus: Use symbolic constants to call message bus methods

These function arguments are arranged in the obvious order from
conceptually largest to smallest: (bus name, path, interface, method).

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie
2024-05-13 12:24:16 +01:00
committed by Philip Withnall
parent 2151a82007
commit fe14968c0d
13 changed files with 105 additions and 97 deletions

View File

@@ -24,6 +24,7 @@
#include <unistd.h>
#include <string.h>
#include "gdbusprivate.h"
#include "gdbus-tests.h"
/* all tests rely on a global connection */
@@ -185,9 +186,9 @@ test_delivery_in_thread_func (gpointer _data)
* Check that we get a reply to the GetId() method call.
*/
g_dbus_connection_call (c,
"org.freedesktop.DBus", /* bus_name */
"/org/freedesktop/DBus", /* object path */
"org.freedesktop.DBus", /* interface name */
DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
"GetId", /* method name */
NULL, NULL,
G_DBUS_CALL_FLAGS_NONE,
@@ -212,9 +213,9 @@ test_delivery_in_thread_func (gpointer _data)
ca = g_cancellable_new ();
g_cancellable_cancel (ca);
g_dbus_connection_call (c,
"org.freedesktop.DBus", /* bus_name */
"/org/freedesktop/DBus", /* object path */
"org.freedesktop.DBus", /* interface name */
DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
"GetId", /* method name */
NULL, NULL,
G_DBUS_CALL_FLAGS_NONE,
@@ -239,9 +240,9 @@ test_delivery_in_thread_func (gpointer _data)
*/
ca = g_cancellable_new ();
g_dbus_connection_call (c,
"org.freedesktop.DBus", /* bus_name */
"/org/freedesktop/DBus", /* object path */
"org.freedesktop.DBus", /* interface name */
DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
"GetId", /* method name */
NULL, NULL,
G_DBUS_CALL_FLAGS_NONE,
@@ -563,8 +564,8 @@ ensure_connection_works (GDBusConnection *conn)
GVariant *v;
GError *error = NULL;
v = g_dbus_connection_call_sync (conn, "org.freedesktop.DBus",
"/org/freedesktop/DBus", "org.freedesktop.DBus", "GetId", NULL, NULL, 0, -1,
v = g_dbus_connection_call_sync (conn, DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "GetId", NULL, NULL, 0, -1,
NULL, &error);
g_assert_no_error (error);
g_assert_nonnull (v);