deskbar-applet r2478 - in trunk: . deskbar/handlers
- From: sebp svn gnome org
- To: svn-commits-list gnome org
- Subject: deskbar-applet r2478 - in trunk: . deskbar/handlers
- Date: Fri, 14 Nov 2008 09:45:55 +0000 (UTC)
Author: sebp
Date: Fri Nov 14 09:45:55 2008
New Revision: 2478
URL: http://svn.gnome.org/viewvc/deskbar-applet?rev=2478&view=rev
Log:
Fixed bug #560190: Added RebootAction and RebootMatch
Modified:
trunk/ChangeLog
trunk/deskbar/handlers/gdmactions.py
Modified: trunk/deskbar/handlers/gdmactions.py
==============================================================================
--- trunk/deskbar/handlers/gdmactions.py (original)
+++ trunk/deskbar/handlers/gdmactions.py Fri Nov 14 09:45:55 2008
@@ -168,6 +168,29 @@
def get_verb(self):
return _("Shutdown the machine")
+
+class RebootAction(GpmAction):
+
+ def __init__(self):
+ GpmAction.__init__(self)
+
+ def activate(self, text=None):
+ prompt = LogoutPrompt(PROMPT_REBOOT, TIMEOUT)
+ response = prompt.run()
+ prompt.destroy()
+
+ try:
+ if response == gtk.RESPONSE_OK:
+ self._gpm.Reboot()
+ except dbus.exceptions.DBusException:
+ # this will trigger a method timeout exception.
+ # As a workaround we swallow it silently
+ pass
+
+ def get_verb(self):
+ return _("Reboot the machine")
+
+
class LockScreenAction(deskbar.interfaces.Action):
def __init__(self):
@@ -207,7 +230,12 @@
def __init__(self, **args):
GpmMatch.__init__(self, icon = "gnome-shutdown")
self.add_action( ShutdownAction() )
-
+
+class RebootMatch(GpmMatch):
+ def __init__(self, **args):
+ GpmMatch.__init__(self, icon = "gtk-refresh")
+ self.add_action( RebootAction() )
+
class LockScreenMatch(deskbar.interfaces.Match):
def __init__(self, **args):
deskbar.interfaces.Match.__init__(self, name=_("Lock"), icon = "system-lock-screen", **args)
@@ -301,7 +329,7 @@
class GdmRebootMatch(GdmMatch):
def __init__(self, **args):
- GdmMatch.__init__(self, name=_("Restart"), **args)
+ GdmMatch.__init__(self, name=_("Restart"), icon = "gtk-refresh", **args)
self.add_action( GdmRebootAction(self.get_name()) )
class GdmSwitchUserAction(GdmAction):
@@ -362,6 +390,8 @@
self.indexer.add(_("Hibernate"), HibernateMatch())
if gpm.CanShutdown():
self.indexer.add(_("Shutdown"), ShutdownMatch())
+ if gpm.CanReboot():
+ self.indexer.add(_("Reboot"), RebootMatch())
except dbus.DBusException:
return False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]