Blob Blame History Raw
diff -Naur audacious-plugins-3.9-orig/src/gnomeshortcuts/gnomeshortcuts.cc audacious-plugins-3.9/src/gnomeshortcuts/gnomeshortcuts.cc
--- audacious-plugins-3.9-orig/src/gnomeshortcuts/gnomeshortcuts.cc	2017-08-20 03:20:10.000000000 +0200
+++ audacious-plugins-3.9/src/gnomeshortcuts/gnomeshortcuts.cc	2018-02-25 02:16:16.361665572 +0100
@@ -23,6 +23,7 @@
 #include <string.h>
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib-bindings.h>
+#include <dbus/dbus-glib-lowlevel.h>
 #include <glib-object.h>
 
 #include <libaudcore/drct.h>
@@ -40,7 +41,7 @@
         about
     };
 
-    constexpr GNOMEShortcuts () : GeneralPlugin (info, false) {}
+    constexpr GNOMEShortcuts () : GeneralPlugin (info, true) {}
 
     bool init ();
     void cleanup ();
@@ -227,6 +228,7 @@
 {
     DBusGConnection *bus;
     GError *error = nullptr;
+    DBusError derror;
     dbus_g_thread_init();
 
     bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
@@ -235,8 +237,17 @@
         g_error_free (error);
         return false;
     } else {
+        dbus_error_init(&derror);
+        if ( !dbus_bus_name_has_owner(dbus_g_connection_get_connection(bus),
+                                      "org.gnome.SettingsDaemon.MediaKeys", &derror) ) {
+            if (dbus_error_is_set(&derror)) {
+                g_warning("%s", derror.message);
+                dbus_error_free(&derror);
+            }
+            return false;
+        }
         media_player_keys_proxy = dbus_g_proxy_new_for_name (bus,
-         "org.gnome.SettingsDaemon",
+         "org.gnome.SettingsDaemon.MediaKeys",
          "/org/gnome/SettingsDaemon/MediaKeys",
          "org.gnome.SettingsDaemon.MediaKeys");
         if (media_player_keys_proxy == nullptr)