Commit 42f75ed4 authored by Bastien Nocera's avatar Bastien Nocera

media-keys: Fix mmkeys D-Bus API to match API docs

Bizarrely, since 2011, gnome-settings-daemon was documented as using
org.gnome.SettingsDaemon.MediaKeys D-Bus name, but everybody ended up
using the org.gnome.SettingsDaemon owned by the daemon instead, and
never reported the discrepancy.

This fixes the code to match the 6-year old API as documented by owning
the org.gnome.SettingsDaemon.MediaKeys as well as the
org.gnome.SettingsDaemon D-Bus name to give 3rd-party users time to
adapt their code.

The portion of this patch adding the org.gnome.SettingsDaemon.MediaKeys
name owning will need to be backported as far as reasonably possible by
distributions, and all users of the API changed before GNOME 3.26. This
would obviously have been easier if the problem was reported when
detected, committer of this fix included.

https://bugzilla.gnome.org/show_bug.cgi?id=781326
parent 1de232bd
......@@ -222,6 +222,9 @@ struct GsdMediaKeysManagerPrivate
guint start_idle_id;
/* Multimedia keys */
guint mmkeys_name_id;
guint gsd_name_id;
MprisController *mpris_controller;
};
......@@ -2929,6 +2932,16 @@ gsd_media_keys_manager_stop (GsdMediaKeysManager *manager)
priv->start_idle_id = 0;
}
if (priv->mmkeys_name_id > 0) {
g_bus_unown_name (priv->mmkeys_name_id);
priv->mmkeys_name_id = 0;
}
if (priv->gsd_name_id > 0) {
g_bus_unown_name (priv->gsd_name_id);
priv->gsd_name_id = 0;
}
if (priv->bus_cancellable != NULL) {
g_cancellable_cancel (priv->bus_cancellable);
g_object_unref (priv->bus_cancellable);
......@@ -3230,6 +3243,15 @@ on_bus_gotten (GObject *source_object,
NULL,
NULL);
manager->priv->mmkeys_name_id = g_bus_own_name_on_connection (manager->priv->connection,
"org.gnome.SettingsDaemon.MediaKeys",
G_BUS_NAME_OWNER_FLAGS_NONE,
NULL, NULL, NULL, NULL);
manager->priv->gsd_name_id = g_bus_own_name_on_connection (manager->priv->connection,
"org.gnome.SettingsDaemon",
G_BUS_NAME_OWNER_FLAGS_NONE,
NULL, NULL, NULL, NULL);
g_dbus_proxy_new (manager->priv->connection,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment