-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEndSessionDialogServer.vala
More file actions
52 lines (42 loc) · 1.67 KB
/
EndSessionDialogServer.vala
File metadata and controls
52 lines (42 loc) · 1.67 KB
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
/*
* SPDX-License-Identifier: GPL-2.0-or-later
* SPDX-FileCopyrightText: 2011-2024 elementary, Inc. (https://elementary.io)
*/
[DBus (name = "io.elementary.wingpanel.session.EndSessionDialog")]
public class QuickSettings.EndSessionDialogServer : Object {
private static EndSessionDialogServer? instance;
[DBus (visible = false)]
public static void init () {
Bus.own_name (BusType.SESSION, "io.elementary.wingpanel.session.EndSessionDialog", BusNameOwnerFlags.NONE,
(connection) => {
try {
connection.register_object ("/io/elementary/wingpanel/session/EndSessionDialog", get_default ());
} catch (Error e) {
warning (e.message);
}
},
() => {},
() => warning ("Could not acquire name"));
}
public static unowned EndSessionDialogServer get_default () {
if (instance == null) {
instance = new EndSessionDialogServer ();
}
return instance;
}
[DBus (visible = false)]
public signal void show_dialog (uint type);
public signal void confirmed_logout ();
public signal void confirmed_reboot ();
public signal void confirmed_shutdown ();
public signal void canceled ();
public signal void closed ();
private EndSessionDialogServer () {
}
public void open (uint type, uint timestamp, uint open_length, ObjectPath[] inhibiters) throws Error {
if (type > (int) EndSessionDialogType.RESTART) {
throw new DBusError.NOT_SUPPORTED ("Hibernate, suspend and hybrid sleep are not supported actions yet");
}
show_dialog (type);
}
}