mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-14 23:34:08 +00:00
libobs/util: Split bus name from interface
When calling D-Bus methods, three fields are required: * The bus name, which is what applications own when they want to expose themselves to D-Bus; * The object path, which represents a D-Bus object exported under a bus name; * The interface, which holds the methods and signals; While out of pure coincidence all the D-Bus buses have a matching interface name, it is technically incorrect to assume that. Add a new 'interface' field to service_info, and split the bus name.
This commit is contained in:
parent
ec1b07cc85
commit
7f27963caa
|
@ -31,6 +31,7 @@ enum service_type {
|
||||||
struct service_info {
|
struct service_info {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *path;
|
const char *path;
|
||||||
|
const char *interface;
|
||||||
const char *uninhibit;
|
const char *uninhibit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,24 +40,28 @@ static const struct service_info services[] = {
|
||||||
{
|
{
|
||||||
.name = "org.freedesktop.ScreenSaver",
|
.name = "org.freedesktop.ScreenSaver",
|
||||||
.path = "/ScreenSaver",
|
.path = "/ScreenSaver",
|
||||||
|
.interface = "org.freedesktop.ScreenSaver",
|
||||||
.uninhibit = "UnInhibit",
|
.uninhibit = "UnInhibit",
|
||||||
},
|
},
|
||||||
[FREEDESKTOP_PM] =
|
[FREEDESKTOP_PM] =
|
||||||
{
|
{
|
||||||
.name = "org.freedesktop.PowerManagement.Inhibit",
|
.name = "org.freedesktop.PowerManagement.Inhibit",
|
||||||
.path = "/org/freedesktop/PowerManagement",
|
.path = "/org/freedesktop/PowerManagement",
|
||||||
|
.interface = "org.freedesktop.PowerManagement.Inhibit",
|
||||||
.uninhibit = "UnInhibit",
|
.uninhibit = "UnInhibit",
|
||||||
},
|
},
|
||||||
[MATE_SM] =
|
[MATE_SM] =
|
||||||
{
|
{
|
||||||
.name = "org.mate.SessionManager",
|
.name = "org.mate.SessionManager",
|
||||||
.path = "/org/mate/SessionManager",
|
.path = "/org/mate/SessionManager",
|
||||||
|
.interface = "org.mate.SessionManager",
|
||||||
.uninhibit = "Uninhibit",
|
.uninhibit = "Uninhibit",
|
||||||
},
|
},
|
||||||
[GNOME_SM] =
|
[GNOME_SM] =
|
||||||
{
|
{
|
||||||
.name = "org.gnome.SessionManager",
|
.name = "org.gnome.SessionManager",
|
||||||
.path = "/org/gnome/SessionManager",
|
.path = "/org/gnome/SessionManager",
|
||||||
|
.interface = "org.gnome.SessionManager",
|
||||||
.uninhibit = "Uninhibit",
|
.uninhibit = "Uninhibit",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -153,11 +158,10 @@ void dbus_inhibit_sleep(struct dbus_sleep_info *info, const char *reason,
|
||||||
params = g_variant_new("(u)", info->cookie);
|
params = g_variant_new("(u)", info->cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
reply = g_dbus_connection_call_sync(info->c, info->service->name,
|
reply = g_dbus_connection_call_sync(
|
||||||
info->service->path,
|
info->c, info->service->name, info->service->path,
|
||||||
info->service->name, method, params,
|
info->service->interface, method, params, NULL,
|
||||||
NULL, G_DBUS_CALL_FLAGS_NONE, -1,
|
G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
|
||||||
NULL, &error);
|
|
||||||
|
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
blog(LOG_ERROR, "Failed to call %s: %s", method,
|
blog(LOG_ERROR, "Failed to call %s: %s", method,
|
||||||
|
|
Loading…
Reference in a new issue