dbus: System bus is optional, we only need a session bus (thanks, tamo!).

Fixes Bugzilla #4795.
This commit is contained in:
Ryan C. Gordon 2020-03-26 20:28:04 -04:00
parent 07f231eeae
commit 369e5f33fb
1 changed files with 10 additions and 4 deletions

View File

@ -125,18 +125,24 @@ SDL_DBus_Init(void)
}
dbus.error_init(&err);
/* session bus is required */
dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err);
if (!dbus.error_is_set(&err)) {
dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err);
}
if (dbus.error_is_set(&err)) {
dbus.error_free(&err);
SDL_DBus_Quit();
is_dbus_available = SDL_FALSE;
return; /* oh well */
}
dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0);
dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0);
/* system bus is optional */
dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err);
if (!dbus.error_is_set(&err)) {
dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0);
}
dbus.error_free(&err);
}
}