[gnome-packagekit/gnome-2-28] When we ask to logout, actually logout, rather than shutdown.



commit 1778f5b0eb9eb9c2dec1ac729b74d27c42108e72
Author: Richard Hughes <richard hughsie com>
Date:   Thu Jan 28 16:31:20 2010 +0000

    When we ask to logout, actually logout, rather than shutdown.

 src/gpk-session.c       |    4 +++-
 src/gpk-update-viewer.c |   30 +++++-------------------------
 2 files changed, 8 insertions(+), 26 deletions(-)
---
diff --git a/src/gpk-session.c b/src/gpk-session.c
index 2d4c820..29a80e7 100644
--- a/src/gpk-session.c
+++ b/src/gpk-session.c
@@ -97,7 +97,9 @@ gpk_session_logout (GpkSession *session)
 	}
 
 	/* we have to use no reply, as the SM calls into g-p-m to get the can_suspend property */
-	dbus_g_proxy_call_no_reply (session->priv->proxy, "Shutdown", G_TYPE_INVALID);
+	dbus_g_proxy_call_no_reply (session->priv->proxy, "Logout",
+				    G_TYPE_UINT, 1, /* no confirmation, but use inhibitors */
+				    G_TYPE_INVALID);
 	return TRUE;
 }
 
diff --git a/src/gpk-update-viewer.c b/src/gpk-update-viewer.c
index 0275bad..be742f8 100644
--- a/src/gpk-update-viewer.c
+++ b/src/gpk-update-viewer.c
@@ -43,6 +43,7 @@
 #include "gpk-common.h"
 #include "gpk-gnome.h"
 #include "gpk-dialog.h"
+#include "gpk-session.h"
 #include "gpk-error.h"
 #include "gpk-cell-renderer-size.h"
 #include "gpk-cell-renderer-info.h"
@@ -106,31 +107,10 @@ static gboolean gpk_update_viewer_get_new_update_list (void);
 static void
 gpk_update_viewer_logout (void)
 {
-	DBusGConnection *connection;
-	DBusGProxy *proxy;
-	GError *error = NULL;
-	gboolean ret;
-
-	/* get org.gnome.Session interface */
-	connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
-	proxy = dbus_g_proxy_new_for_name_owner (connection, GNOME_SESSION_MANAGER_SERVICE,
-						 GNOME_SESSION_MANAGER_PATH,
-						 GNOME_SESSION_MANAGER_INTERFACE, &error);
-	if (proxy == NULL) {
-		egg_warning ("cannot connect to proxy %s: %s", GNOME_SESSION_MANAGER_SERVICE, error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* log out of the session */
-	ret = dbus_g_proxy_call (proxy, "Shutdown", &error, G_TYPE_INVALID);
-	if (!ret) {
-		egg_warning ("cannot shutdown session: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
-out:
-	g_object_unref (proxy);
+	GpkSession *session;
+	session = gpk_session_new ();
+	gpk_session_logout (session);
+	g_object_unref (session);
 }
 
 /**



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