--- gnome-panel-2.23.1/gnome-panel/panel-action-button.c.orig	2008-04-22 03:50:16.000000000 +0800
+++ gnome-panel-2.23.1/gnome-panel/panel-action-button.c	2008-05-13 16:42:34.185405000 +0800
@@ -27,6 +27,8 @@
 #include <config.h>
 #include <string.h>
 #include <stdlib.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib-bindings.h>
 
 #include "panel-action-button.h"
 
@@ -150,6 +152,55 @@
 				  callback_name);
 }
 
+#define GSM_DBUS_SERVICE "org.gnome.SessionManager"
+#define GSM_DBUS_PATH "/org/gnome/SessionManager"
+#define GSM_DBUS_INTERFACE "org.gnome.SessionManager"
+
+/**
+ * gsm_dbus_method:
+ * @method: The g-s-m DBUS method name, e.g. "Logout" or "Shutdown"
+ **/
+static gboolean
+gsm_dbus_method (const gchar *method)
+{
+	DBusGConnection *connection;
+	DBusGProxy *proxy;
+	GError *error = NULL;
+	gboolean ret = FALSE;
+	
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if (connection == NULL) {
+		if (error) {
+			g_warning ("Couldn't connect to session message bus %s",
+				     error->message);
+			g_error_free (error);
+		}
+		return;
+	}
+
+	proxy = dbus_g_proxy_new_for_name (connection,
+					   GSM_DBUS_SERVICE,
+					   GSM_DBUS_PATH,
+					   GSM_DBUS_INTERFACE);
+	if (!strcmp (method, "Logout")) {
+		/* Always set Mode=0, i.e, DO CONFIRMATION */
+		ret = dbus_g_proxy_call (proxy, method, &error,
+				 G_TYPE_INT, 0,
+				 G_TYPE_INVALID,
+				 G_TYPE_INVALID);
+	}
+	else if (!strcmp (method, "Shutdown"))
+		ret = dbus_g_proxy_call (proxy, method, &error,
+				 G_TYPE_INVALID,
+				 G_TYPE_INVALID);
+	if (error) {		
+		g_warning ("ERROR: %s", error->message);
+		g_error_free (error);
+	}
+	g_object_unref (proxy);
+	return ret;
+}
+
 /* Log Out
  */
 static void
@@ -166,17 +217,13 @@
 	if (not_prompt)
 		panel_session_request_logout ();
 	else
-		panel_logout_new (PANEL_LOGOUT_DIALOG_LOGOUT,
-				  gtk_widget_get_screen (widget),
-				  gtk_get_current_event_time ());
+		gsm_dbus_method ("Logout");
 }
 
 static void
 panel_action_shutdown (GtkWidget *widget)
 {
-	panel_logout_new (PANEL_LOGOUT_DIALOG_SHUTDOWN,
-			  gtk_widget_get_screen (widget),
-			  gtk_get_current_event_time ());
+	gsm_dbus_method ("Shutdown");
 }
 
 static gboolean
