summarylogtreecommitdiffstats
path: root/wingpanel-indicator-session-standalone-01-shutdown.patch
blob: 14163ecf2a66135baf7dde6b5953fdb53668c6a8 (plain)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
diff --git a/src/Indicator.vala b/src/Indicator.vala
index bd130cf..8dde95d 100644
--- a/src/Indicator.vala
+++ b/src/Indicator.vala
@@ -49,9 +49,6 @@ public class Session.Indicator : Wingpanel.Indicator {
         this.server_type = server_type;
         this.visible = true;
 
-        EndSessionDialogServer.init ();
-        EndSessionDialogServer.get_default ().show_dialog.connect ((type) => show_dialog ((Widgets.EndSessionDialogType)type));
-
         manager = new Session.Services.UserManager ();
     }
 
@@ -74,10 +71,10 @@ public class Session.Indicator : Wingpanel.Indicator {
                     if (session_interface == null) {
                         init_interfaces.begin ((obj, res) => {
                             init_interfaces.end (res);
-                            show_shutdown_dialog ();
+                            system_interface.power_off (true);
                         });
                     } else {
-                        show_shutdown_dialog ();
+                        system_interface.power_off (true);
                     }
 
                     return Gdk.EVENT_STOP;
@@ -198,7 +195,7 @@ public class Session.Indicator : Wingpanel.Indicator {
             });
 
             shutdown.clicked.connect (() => {
-                show_shutdown_dialog ();
+                system_interface.power_off (true);
             });
 
             suspend.clicked.connect (() => {
@@ -237,26 +234,6 @@ public class Session.Indicator : Wingpanel.Indicator {
         return main_grid;
     }
 
-    private void show_shutdown_dialog () {
-        close ();
-
-        if (server_type == Wingpanel.IndicatorManager.ServerType.SESSION) {
-            // Ask gnome-session to "reboot" which throws the EndSessionDialog
-            // Our "reboot" dialog also has a shutdown button to give the choice between reboot/shutdown
-            session_interface.reboot.begin ((obj, res) => {
-                try {
-                    session_interface.reboot.end (res);
-                } catch (Error e) {
-                    if (!(e is GLib.IOError.CANCELLED)) {
-                        critical ("Unable to open shutdown dialog: %s", e.message);
-                    }
-                }
-            });
-        } else {
-            show_dialog (Widgets.EndSessionDialogType.RESTART);
-        }
-    }
-
     private async void init_interfaces () {
         try {
             system_interface = yield Bus.get_proxy (BusType.SYSTEM, "org.freedesktop.login1", "/org/freedesktop/login1");
@@ -298,62 +298,6 @@
 
     public override void closed () {}
 
-    private void show_dialog (Widgets.EndSessionDialogType type) {
-        close ();
-
-        if (current_dialog != null) {
-            if (current_dialog.dialog_type != type) {
-                current_dialog.destroy ();
-            } else {
-                return;
-            }
-        }
-
-        unowned EndSessionDialogServer server = EndSessionDialogServer.get_default ();
-
-        current_dialog = new Widgets.EndSessionDialog (type) {
-            transient_for = (Gtk.Window) indicator_icon.get_toplevel ()
-        };
-        current_dialog.destroy.connect (() => {
-            server.closed ();
-            current_dialog = null;
-        });
-
-        current_dialog.cancelled.connect (() => {
-            server.canceled ();
-        });
-
-        current_dialog.logout.connect (() => {
-            server.confirmed_logout ();
-        });
-
-        current_dialog.shutdown.connect (() => {
-            if (server_type == Wingpanel.IndicatorManager.ServerType.SESSION) {
-                server.confirmed_shutdown ();
-            } else {
-                try {
-                    system_interface.power_off (false);
-                } catch (Error e) {
-                    warning ("Unable to shutdown: %s", e.message);
-                }
-            }
-        });
-
-        current_dialog.reboot.connect (() => {
-            if (server_type == Wingpanel.IndicatorManager.ServerType.SESSION) {
-                server.confirmed_reboot ();
-            } else {
-                try {
-                    system_interface.reboot (false);
-                } catch (Error e) {
-                    warning ("Unable to reboot: %s", e.message);
-                }
-            }
-        });
-
-        current_dialog.show_all ();
-    }
-
     private async void update_tooltip () {
         string description;