Blob Blame History Raw
diff -Nurb --strip-trailing-cr audacious-plugins-3.6-alpha1-gtk3-orig/src/gnomeshortcuts/gnomeshortcuts.cc audacious-plugins-3.6-alpha1-gtk3/src/gnomeshortcuts/gnomeshortcuts.cc
--- audacious-plugins-3.6-alpha1-gtk3-orig/src/gnomeshortcuts/gnomeshortcuts.cc	2014-12-06 00:07:48.000000000 +0100
+++ audacious-plugins-3.6-alpha1-gtk3/src/gnomeshortcuts/gnomeshortcuts.cc	2014-12-09 23:04:45.000000000 +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,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(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",