This repository has been archived by the owner on Oct 22, 2019. It is now read-only.
forked from doorknob60/pygtk-shutdown
/
systemd.patch
82 lines (72 loc) · 3.05 KB
/
systemd.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
--- pygtk-shutdown 2011-08-22 19:18:04.000000000 -0700
+++ pygtk-shutdown-systemd 2011-08-22 19:19:40.000000000 -0700
@@ -37,13 +37,17 @@
self.frame1 = gtk.Frame()
self.frame2 = gtk.Frame()
+ self.frame3 = gtk.Frame()
self.layoutBox = gtk.VBox(False, 5)
self.layoutBox.set_border_width(5)
self.buttonsBox1 = gtk.HBox(True, 5)
self.buttonsBox2 = gtk.HBox(True, 5)
+ self.buttonsBox3 = gtk.HBox(True, 5)
self.buttonsBox1.set_border_width(5)
+ self.buttonsBox2 = gtk.HBox(True, 5)
self.buttonsBox2.set_border_width(5)
+ self.buttonsBox3.set_border_width(5)
self.cancelButtonAlignment = gtk.Alignment(1.0, 0.5)
self.logoutButton = gtk.Button("Logout")
@@ -61,16 +65,30 @@
ico.set_from_icon_name("gnome-shutdown", iconsize)
self.haltButton.set_image(ico)
+ self.suspendButton = gtk.Button("Suspend")
+ ico = gtk.Image()
+ ico.set_from_icon_name("gnome-session-suspend", iconsize)
+ self.suspendButton.set_image(ico)
+
+ self.hibernateButton = gtk.Button("Hibernate")
+ ico = gtk.Image()
+ ico.set_from_icon_name("gnome-session-hibernate", iconsize)
+ self.hibernateButton.set_image(ico)
+
self.cancelButton = gtk.Button(None, gtk.STOCK_CANCEL)
self.buttonsBox1.pack_start(self.logoutButton)
self.buttonsBox2.pack_start(self.restartButton)
self.buttonsBox2.pack_start(self.haltButton)
+ self.buttonsBox3.pack_start(self.suspendButton)
+ self.buttonsBox3.pack_start(self.hibernateButton)
self.cancelButtonAlignment.add(self.cancelButton)
self.frame1.add(self.buttonsBox1)
self.frame2.add(self.buttonsBox2)
+ self.frame3.add(self.buttonsBox3)
self.layoutBox.pack_start(self.frame1)
self.layoutBox.pack_start(self.frame2)
+ self.layoutBox.pack_start(self.frame3)
self.layoutBox.pack_start(self.cancelButtonAlignment)
self.window.add(self.layoutBox)
@@ -88,6 +106,8 @@
self.logoutButton.connect("clicked", self.logout)
self.restartButton.connect("clicked", self.reboot)
self.haltButton.connect("clicked", self.shutdown)
+ self.suspendButton.connect("clicked", self.suspend)
+ self.hibernateButton.connect("clicked", self.hibernate)
def main(self):
gtk.main()
@@ -100,11 +120,19 @@
gtk.main_quit()
def shutdown(self, widget = None, data = None):
- os.system("/usr/bin/gksudo \"/sbin/shutdown -h now\" &")
+ os.system("systemctl poweroff &")
gtk.main_quit()
def reboot(self, widget = None, data = None):
- os.system("/usr/bin/gksudo \"/sbin/shutdown -r now\" &")
+ os.system("systemctl reboot &")
+ gtk.main_quit()
+
+ def suspend(self, widget = None, data = None):
+ os.system("systemctl suspend &")
+ gtk.main_quit()
+
+ def hibernate(self, widget = None, data = None):
+ os.system("systemctl hibernate &")
gtk.main_quit()
def main():