gdbus: Move protocol constants from gdbusdaemon into gdbusprivate.h

These well-known flags and replies are part of the D-Bus Specification,
and also exist with the same names in libdbus header files.
Moving them into a private header means that unit tests like
gdbus-proxy-threads and gdbus-subscribe don't have to reinvent them.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie
2024-05-13 12:55:04 +01:00
committed by Philip Withnall
parent b0e8612a3b
commit 7401577074
8 changed files with 32 additions and 47 deletions

View File

@@ -319,20 +319,20 @@ request_name_cb (GObject *source_object,
switch (request_name_reply)
{
case 1: /* DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER */
case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
/* We got the name - now listen for NameLost and NameAcquired */
call_acquired_handler (client);
break;
case 2: /* DBUS_REQUEST_NAME_REPLY_IN_QUEUE */
case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
/* Waiting in line - listen for NameLost and NameAcquired */
call_lost_handler (client);
break;
default:
/* assume we couldn't get the name - explicit fallthrough */
case 3: /* DBUS_REQUEST_NAME_REPLY_EXISTS */
case 4: /* DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER */
case DBUS_REQUEST_NAME_REPLY_EXISTS:
case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
/* Some other part of the process is already owning the name */
call_lost_handler (client);
unsubscribe = TRUE;
@@ -954,7 +954,7 @@ g_bus_unown_name (guint owner_id)
else
{
g_variant_get (result, "(u)", &release_name_reply);
if (release_name_reply != 1 /* DBUS_RELEASE_NAME_REPLY_RELEASED */)
if (release_name_reply != DBUS_RELEASE_NAME_REPLY_RELEASED)
{
g_warning ("Unexpected reply %d when releasing name %s", release_name_reply, client->name);
}