Blob Blame History Raw
diff -Nur audacious-plugins-3.8.2-orig/src/gnomeshortcuts/gnomeshortcuts.cc audacious-plugins-3.8.2/src/gnomeshortcuts/gnomeshortcuts.cc
--- audacious-plugins-3.8.2-orig/src/gnomeshortcuts/gnomeshortcuts.cc	2017-01-20 18:03:32.000000000 +0100
+++ audacious-plugins-3.8.2/src/gnomeshortcuts/gnomeshortcuts.cc	2017-05-13 20:24:27.342147415 +0200
@@ -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,6 +237,15 @@
         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", &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",