gdbus: Use symbolic constants for interfaces from dbus-specification

Most D-Bus interfaces are domain-specific, but these interfaces from the
D-Bus Specification are intended to be commonly used in any context for
which they are found to be appropriate.

Most of these use `gdbusprivate.h`. One exception is that
`gio/tests/gdbus-example-*` redefine the constants locally: due to these
files' dual role as part of the unit tests and as sample code, it seems
desirable to ensure that they can still be compiled outside GLib.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie
2024-05-13 13:00:34 +01:00
committed by Philip Withnall
parent b4f8d4a5d5
commit 7c609f8142
18 changed files with 95 additions and 75 deletions

View File

@@ -25,6 +25,7 @@
#include <string.h>
#include <stdio.h>
#include "gdbusprivate.h"
#include "gdbus-tests.h"
#include "gstdio.h"
@@ -1511,7 +1512,7 @@ introspect (GDBusConnection *connection,
g_dbus_connection_call (connection,
name,
object_path,
"org.freedesktop.DBus.Introspectable",
DBUS_INTERFACE_INTROSPECTABLE,
"Introspect",
NULL, /* params */
G_VARIANT_TYPE ("(s)"),
@@ -1603,7 +1604,7 @@ om_check_get_all (GDBusConnection *c,
g_dbus_connection_call (c,
g_dbus_connection_get_unique_name (c),
"/managed",
"org.freedesktop.DBus.ObjectManager",
DBUS_INTERFACE_OBJECT_MANAGER,
"GetManagedObjects",
NULL, /* params */
G_VARIANT_TYPE ("(a{oa{sa{sv}}})"),
@@ -2016,7 +2017,7 @@ check_object_manager (void)
om_signal_id = g_dbus_connection_signal_subscribe (c,
NULL, /* sender */
"org.freedesktop.DBus.ObjectManager",
DBUS_INTERFACE_OBJECT_MANAGER,
NULL, /* member */
NULL, /* object_path */
NULL, /* arg0 */
@@ -2060,7 +2061,7 @@ check_object_manager (void)
/* Check that the manager object is visible */
info = introspect (c, g_dbus_connection_get_unique_name (c), "/managed", loop);
g_assert_cmpint (count_interfaces (info), ==, 4); /* ObjectManager + Properties,Introspectable,Peer */
g_assert (has_interface (info, "org.freedesktop.DBus.ObjectManager"));
g_assert (has_interface (info, DBUS_INTERFACE_OBJECT_MANAGER));
g_assert_cmpint (count_nodes (info), ==, 0);
g_dbus_node_info_unref (info);