updated on Sat Jan 21 04:00:54 UTC 2012
[aur-mirror.git] / gnome-session-ubuntu / 95_dbus_request_shutdown.patch
blob2ec407781d55658741d25d9dd4092f96118ae853
1 Description: Add "RequestShutdown" and "RequestReboot" DBus methods to allow
2 other applications to shutdown or reboot the machine via the session manager
3 Author: Chris Coulson <chrisccoulson@ubuntu.com>
5 Index: gnome-session-2.32.1/gnome-session/gsm-manager.c
6 ===================================================================
7 --- gnome-session-2.32.1.orig/gnome-session/gsm-manager.c 2010-11-17 16:23:49.851939998 +0100
8 +++ gnome-session-2.32.1/gnome-session/gsm-manager.c 2010-11-17 16:23:50.203940000 +0100
9 @@ -3087,6 +3087,48 @@
12 gboolean
13 +gsm_manager_request_shutdown (GsmManager *manager,
14 + GError **error)
16 + g_debug ("GsmManager: RequestShutdown called");
18 + g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE);
20 + if (manager->priv->phase != GSM_MANAGER_PHASE_RUNNING) {
21 + g_set_error (error,
22 + GSM_MANAGER_ERROR,
23 + GSM_MANAGER_ERROR_NOT_IN_RUNNING,
24 + "RequestShutdown interface is only available during the Running phase");
25 + return FALSE;
26 + }
28 + request_shutdown (manager);
30 + return TRUE;
33 +gboolean
34 +gsm_manager_request_reboot (GsmManager *manager,
35 + GError **error)
37 + g_debug ("GsmManager: RequestReboot called");
39 + g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE);
41 + if (manager->priv->phase != GSM_MANAGER_PHASE_RUNNING) {
42 + g_set_error (error,
43 + GSM_MANAGER_ERROR,
44 + GSM_MANAGER_ERROR_NOT_IN_RUNNING,
45 + "RequestReboot interface is only available during the Running phase");
46 + return FALSE;
47 + }
49 + request_reboot (manager);
51 + return TRUE;
54 +gboolean
55 gsm_manager_shutdown (GsmManager *manager,
56 GError **error)
58 Index: gnome-session-2.32.1/gnome-session/gsm-manager.h
59 ===================================================================
60 --- gnome-session-2.32.1.orig/gnome-session/gsm-manager.h 2010-11-17 16:23:45.999939999 +0100
61 +++ gnome-session-2.32.1/gnome-session/gsm-manager.h 2010-11-17 16:23:50.203940000 +0100
62 @@ -148,7 +148,10 @@
63 guint flags,
64 gboolean *is_inhibited,
65 GError *error);
67 +gboolean gsm_manager_request_shutdown (GsmManager *manager,
68 + GError **error);
69 +gboolean gsm_manager_request_reboot (GsmManager *manager,
70 + GError **error);
71 gboolean gsm_manager_shutdown (GsmManager *manager,
72 GError **error);
74 Index: gnome-session-2.32.1/gnome-session/org.gnome.SessionManager.xml
75 ===================================================================
76 --- gnome-session-2.32.1.orig/gnome-session/org.gnome.SessionManager.xml 2010-11-17 16:23:46.007939999 +0100
77 +++ gnome-session-2.32.1/gnome-session/org.gnome.SessionManager.xml 2010-11-17 16:23:50.203940000 +0100
78 @@ -309,6 +309,23 @@
79 </doc:doc>
80 </method>
82 + <method name="RequestShutdown">
83 + <doc:doc>
84 + <doc:description>
85 + <doc:para>Request a shutdown with no dialog</doc:para>
86 + </doc:description>
87 + </doc:doc>
88 + </method>
90 + <method name="RequestReboot">
91 + <doc:doc>
92 + <doc:description>
93 + <doc:para>Request a reboot with no dialog</doc:para>
94 + </doc:description>
95 + </doc:doc>
96 + </method>
99 <!-- Signals -->
101 <signal name="ClientAdded">