From 12c92274bc118836d9c6dcb5262b82536ef2fe58 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Fri, 21 Apr 2017 15:30:47 +0200 Subject: [PATCH] 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. 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 --- plugins/media-keys/gsd-media-keys-manager.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c index 33b6762..bf79cd7 100644 --- a/plugins/media-keys/gsd-media-keys-manager.c +++ b/plugins/media-keys/gsd-media-keys-manager.c @@ -219,6 +219,8 @@ struct GsdMediaKeysManagerPrivate guint start_idle_id; + /* Multimedia keys */ + guint mmkeys_name_id; MprisController *mpris_controller; }; @@ -2926,6 +2928,11 @@ 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->bus_cancellable != NULL) { g_cancellable_cancel (priv->bus_cancellable); g_object_unref (priv->bus_cancellable); @@ -3227,6 +3234,11 @@ 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); + g_dbus_proxy_new (manager->priv->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, -- 2.9.3