Index: deskbar/handlers/gdmactions.py
===================================================================
--- deskbar/handlers/gdmactions.py	(revision 1779)
+++ deskbar/handlers/gdmactions.py	(working copy)
@@ -3,11 +3,58 @@
 import deskbar, deskbar.core.Indexer, deskbar.interfaces.Match, deskbar.interfaces.Module, deskbar.core.Utils
 from deskbar.defs import VERSION
 import deskbar.handlers.gdmclient
-import gtk, gnome.ui
+import gobject, gtk, gnome.ui
 import deskbar.interfaces.Action
 
 HANDLERS = ["GdmHandler"]
 
+( PROMPT_SHUTDOWN,
+  PROMPT_LOGOUT,
+  PROMPT_REBOOT,
+  PROMPT_SUSPEND,
+  PROMPT_HIBERNATE
+) = range(5)
+
+def logout_prompt(prompt_type):
+    if prompt_type == PROMPT_SHUTDOWN:
+        message = _("Shut down of this system now?")
+        secondary = _("This system will be automatically shut down in 60 seconds.")
+        button_label = _("Shut Down")
+    elif prompt_type == PROMPT_LOGOUT:
+        message = _("Log out of this system now?")
+        secondary = _("You will be automatically logged out in 60 seconds.")
+        button_label = _("Log Out")
+    elif prompt_type == PROMPT_REBOOT:
+        message = _("Restart this system now?")
+        secondary = _("This system will be automatically restarted in 60 seconds.")
+        button_label = _("Restart")
+    elif prompt_type == PROMPT_SUSPEND:
+        message = _("Suspend this system now?")
+        secondary = _("This system will be automatically suspended in 60 seconds.")
+        button_label = _("Suspend")
+    elif prompt_type == PROMPT_HIBERNATE:
+        message = _("Hibernate this system now?")
+        secondary = _("This system will be automatically hibernated in 60 seconds.")
+        button_label = _("Hibernate")
+
+    prompt = gtk.MessageDialog(flags=gtk.MESSAGE_QUESTION, message_format=message)
+    prompt.format_secondary_text(secondary)
+
+    prompt.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
+    prompt.add_button(button_label, 0)
+    prompt.set_default_response(0)
+
+    def timeout_func():
+        prompt.response(0)
+        return False
+
+    gobject.timeout_add(60000, timeout_func)
+
+    response = prompt.run()
+    prompt.destroy()
+
+    return response == 0
+
 class GpmAction(deskbar.interfaces.Action):
     
     def __init__(self):
@@ -23,7 +70,8 @@
     
     def activate(self, text=None):
         try:
-            self._gpm.Suspend()
+            if logout_prompt(PROMPT_SUSPEND):
+                self._gpm.Suspend()
         except dbus.DBusException:
             # this will trigger a method timeout exception.
             # As a workaround we swallow it silently
@@ -39,7 +87,8 @@
 
     def activate(self, text=None):
         try:
-            self._gpm.Hibernate()
+            if logout_prompt(PROMPT_HIBERNATE):
+                self._gpm.Hibernate()
         except dbus.DBusException:
             # this will trigger a method timeout exception.
             # As a workaround we swallow it silently
@@ -55,7 +104,8 @@
         
     def activate(self, text=None):
         try:
-            self._gpm.Shutdown()
+            if logout_prompt(PROMPT_SHUTDOWN):
+                self._gpm.Shutdown()
         except dbus.DBusException:
             # this will trigger a method timeout exception.
             # As a workaround we swallow it silently
@@ -142,8 +192,9 @@
         GdmAction.__init__(self, name)
         
     def activate(self, text=None):
-        deskbar.handlers.gdmclient.set_logout_action(deskbar.handlers.gdmclient.LOGOUT_ACTION_SHUTDOWN)
-        self.request_logout()
+        if logout_prompt(PROMPT_SHUTDOWN):
+            deskbar.handlers.gdmclient.set_logout_action(deskbar.handlers.gdmclient.LOGOUT_ACTION_SHUTDOWN)
+            self.request_logout()
         
     def get_verb(self):
         return _("Turn off the computer")
@@ -158,8 +209,9 @@
         GdmAction.__init__(self, name)
         
     def activate(self, text=None):
-        deskbar.handlers.gdmclient.set_logout_action(deskbar.handlers.gdmclient.LOGOUT_ACTION_NONE)
-        self.request_logout()
+        if logout_prompt(PROMPT_LOGOUT):
+            deskbar.handlers.gdmclient.set_logout_action(deskbar.handlers.gdmclient.LOGOUT_ACTION_NONE)
+            self.request_logout()
         
     def get_verb(self):
         return _("Log Out")
@@ -174,8 +226,9 @@
         GdmAction.__init__(self, name)
         
     def activate(self, text=None):
-        deskbar.handlers.gdmclient.set_logout_action(deskbar.handlers.gdmclient.LOGOUT_ACTION_REBOOT)
-        self.request_logout()
+        if logout_prompt(PROMPT_REBOOT):
+            deskbar.handlers.gdmclient.set_logout_action(deskbar.handlers.gdmclient.LOGOUT_ACTION_REBOOT)
+            self.request_logout()
         
     def get_verb(self):
         return _("Restart the computer")
