[gnome-settings-daemon] media-keys: Use new SessionManager singleton



commit e18eb3a05f5d1c3b42c25a04f285f84f960f88ee
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Oct 22 10:01:20 2012 +0200

    media-keys: Use new SessionManager singleton
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686556

 plugins/media-keys/gsd-media-keys-manager.c |   34 +++++++++-----------------
 1 files changed, 12 insertions(+), 22 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 9c84d7f..7e38e57 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -44,6 +44,7 @@
 #include <gudev/gudev.h>
 #endif
 
+#include "gnome-settings-session.h"
 #include "gnome-settings-profile.h"
 #include "gsd-marshal.h"
 #include "gsd-media-keys-manager.h"
@@ -63,10 +64,6 @@
 #define GSD_MEDIA_KEYS_DBUS_PATH GSD_DBUS_PATH "/MediaKeys"
 #define GSD_MEDIA_KEYS_DBUS_NAME GSD_DBUS_NAME ".MediaKeys"
 
-#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager"
-#define GNOME_SESSION_DBUS_PATH "/org/gnome/SessionManager"
-#define GNOME_SESSION_DBUS_INTERFACE "org.gnome.SessionManager"
-
 #define GNOME_KEYRING_DBUS_NAME "org.gnome.keyring"
 #define GNOME_KEYRING_DBUS_PATH "/org/gnome/keyring/daemon"
 #define GNOME_KEYRING_DBUS_INTERFACE "org.gnome.keyring.Daemon"
@@ -762,30 +759,23 @@ gnome_session_shutdown (GsdMediaKeysManager *manager)
 {
 	GError *error = NULL;
 	GVariant *variant;
-
-	/* Shouldn't happen, but you never know */
-	if (manager->priv->connection == NULL) {
-		execute (manager, "gnome-session-quit --logout", FALSE);
-		return;
-	}
-
-	variant = g_dbus_connection_call_sync (manager->priv->connection,
-					       GNOME_SESSION_DBUS_NAME,
-					       GNOME_SESSION_DBUS_PATH,
-					       GNOME_SESSION_DBUS_INTERFACE,
-					       "Shutdown",
-					       NULL,
-					       NULL,
-					       G_DBUS_CALL_FLAGS_NONE,
-					       -1,
-					       NULL,
-					       &error);
+        GDBusProxy *proxy;
+
+        proxy = gnome_settings_session_get_session_proxy ();
+	variant = g_dbus_proxy_call_sync (proxy,
+					  "Shutdown",
+					  NULL,
+					  G_DBUS_CALL_FLAGS_NONE,
+					  -1,
+					  NULL,
+					  &error);
 	if (variant == NULL) {
 		g_warning ("Failed to call Shutdown on session manager: %s", error->message);
 		g_error_free (error);
 		return;
 	}
 	g_variant_unref (variant);
+        g_object_unref (proxy);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]