gdbus: Use symbolic constants for various references to the message bus

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2024-05-13 12:50:42 +01:00 committed by Philip Withnall
parent 19223803f5
commit 131a061aca
4 changed files with 12 additions and 12 deletions

View File

@ -3714,9 +3714,9 @@ remove_match_rule (GDBusConnection *connection,
static gboolean
is_signal_data_for_name_lost_or_acquired (SignalData *signal_data)
{
return g_strcmp0 (signal_data->sender, "org.freedesktop.DBus") == 0 &&
g_strcmp0 (signal_data->interface_name, "org.freedesktop.DBus") == 0 &&
g_strcmp0 (signal_data->object_path, "/org/freedesktop/DBus") == 0 &&
return g_strcmp0 (signal_data->sender, DBUS_SERVICE_DBUS) == 0 &&
g_strcmp0 (signal_data->interface_name, DBUS_INTERFACE_DBUS) == 0 &&
g_strcmp0 (signal_data->object_path, DBUS_PATH_DBUS) == 0 &&
(g_strcmp0 (signal_data->member, "NameLost") == 0 ||
g_strcmp0 (signal_data->member, "NameAcquired") == 0);
}
@ -3885,7 +3885,7 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
*/
rule = args_to_rule (sender, interface_name, member, object_path, arg0, flags);
if (sender != NULL && (g_dbus_is_unique_name (sender) || g_strcmp0 (sender, "org.freedesktop.DBus") == 0))
if (sender != NULL && (g_dbus_is_unique_name (sender) || g_strcmp0 (sender, DBUS_SERVICE_DBUS) == 0))
sender_is_its_own_owner = TRUE;
else
sender_is_its_own_owner = FALSE;

View File

@ -258,9 +258,9 @@ on_name_lost_or_acquired (GDBusConnection *connection,
Client *client = user_data;
const gchar *name;
if (g_strcmp0 (object_path, "/org/freedesktop/DBus") != 0 ||
g_strcmp0 (interface_name, "org.freedesktop.DBus") != 0 ||
g_strcmp0 (sender_name, "org.freedesktop.DBus") != 0)
if (g_strcmp0 (object_path, DBUS_PATH_DBUS) != 0 ||
g_strcmp0 (interface_name, DBUS_INTERFACE_DBUS) != 0 ||
g_strcmp0 (sender_name, DBUS_SERVICE_DBUS) != 0)
goto out;
if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(s)")))

View File

@ -344,9 +344,9 @@ on_name_owner_changed (GDBusConnection *connection,
if (!client->initialized)
goto out;
if (g_strcmp0 (object_path, "/org/freedesktop/DBus") != 0 ||
g_strcmp0 (interface_name, "org.freedesktop.DBus") != 0 ||
g_strcmp0 (sender_name, "org.freedesktop.DBus") != 0)
if (g_strcmp0 (object_path, DBUS_PATH_DBUS) != 0 ||
g_strcmp0 (interface_name, DBUS_INTERFACE_DBUS) != 0 ||
g_strcmp0 (sender_name, DBUS_SERVICE_DBUS) != 0)
goto out;
g_variant_get (parameters,

View File

@ -1052,7 +1052,7 @@ test_connection_filter (void)
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
"GetNameOwner");
g_dbus_message_set_body (m, g_variant_new ("(s)", "org.freedesktop.DBus"));
g_dbus_message_set_body (m, g_variant_new ("(s)", DBUS_SERVICE_DBUS));
error = NULL;
g_dbus_connection_send_message (c, m, G_DBUS_SEND_MESSAGE_FLAGS_NONE, &serial_temp, &error);
g_assert_no_error (error);
@ -1202,7 +1202,7 @@ send_bogus_message (GDBusConnection *c, guint32 *out_serial)
DBUS_PATH_DBUS,
DBUS_INTERFACE_DBUS,
"GetNameOwner");
g_dbus_message_set_body (m, g_variant_new ("(s)", "org.freedesktop.DBus"));
g_dbus_message_set_body (m, g_variant_new ("(s)", DBUS_SERVICE_DBUS));
error = NULL;
g_dbus_connection_send_message (c, m, G_DBUS_SEND_MESSAGE_FLAGS_NONE, out_serial, &error);
g_assert_no_error (error);