Lines 108-113
egg_console_kit_stop (EggConsoleKit *console, GError **error)
Link Here
|
108 |
} |
108 |
} |
109 |
|
109 |
|
110 |
/** |
110 |
/** |
|
|
111 |
* egg_console_kit_suspend: |
112 |
**/ |
113 |
gboolean |
114 |
egg_console_kit_suspend (EggConsoleKit *console, GError **error) |
115 |
{ |
116 |
gboolean ret; |
117 |
GError *error_local = NULL; |
118 |
|
119 |
g_return_val_if_fail (EGG_IS_CONSOLE_KIT (console), FALSE); |
120 |
g_return_val_if_fail (console->priv->proxy_manager != NULL, FALSE); |
121 |
|
122 |
ret = dbus_g_proxy_call (console->priv->proxy_manager, "Suspend", &error_local, |
123 |
G_TYPE_BOOLEAN, TRUE, |
124 |
G_TYPE_INVALID, G_TYPE_INVALID); |
125 |
if (!ret) { |
126 |
egg_warning ("Couldn't suspend: %s", error_local->message); |
127 |
if (error != NULL) |
128 |
*error = g_error_new (1, 0, "%s", error_local->message); |
129 |
g_error_free (error_local); |
130 |
} |
131 |
return ret; |
132 |
} |
133 |
|
134 |
/** |
135 |
* egg_console_kit_hibernate: |
136 |
**/ |
137 |
gboolean |
138 |
egg_console_kit_hibernate (EggConsoleKit *console, GError **error) |
139 |
{ |
140 |
gboolean ret; |
141 |
GError *error_local = NULL; |
142 |
|
143 |
g_return_val_if_fail (EGG_IS_CONSOLE_KIT (console), FALSE); |
144 |
g_return_val_if_fail (console->priv->proxy_manager != NULL, FALSE); |
145 |
|
146 |
ret = dbus_g_proxy_call (console->priv->proxy_manager, "Hibernate", &error_local, |
147 |
G_TYPE_BOOLEAN, TRUE, |
148 |
G_TYPE_INVALID, G_TYPE_INVALID); |
149 |
if (!ret) { |
150 |
egg_warning ("Couldn't hibernate: %s", error_local->message); |
151 |
if (error != NULL) |
152 |
*error = g_error_new (1, 0, "%s", error_local->message); |
153 |
g_error_free (error_local); |
154 |
} |
155 |
return ret; |
156 |
} |
157 |
|
158 |
/** |
111 |
* egg_console_kit_can_stop: |
159 |
* egg_console_kit_can_stop: |
112 |
**/ |
160 |
**/ |
113 |
gboolean |
161 |
gboolean |
Lines 162-167
egg_console_kit_can_restart (EggConsoleKit *console, gboolean *can_restart, GErr
Link Here
|
162 |
} |
210 |
} |
163 |
|
211 |
|
164 |
/** |
212 |
/** |
|
|
213 |
* egg_console_kit_can_suspend: |
214 |
**/ |
215 |
gboolean |
216 |
egg_console_kit_can_suspend (EggConsoleKit *console, gboolean *can_suspend, GError **error) |
217 |
{ |
218 |
GError *error_local = NULL; |
219 |
gboolean ret; |
220 |
gchar *retval; |
221 |
|
222 |
g_return_val_if_fail (EGG_IS_CONSOLE_KIT (console), FALSE); |
223 |
g_return_val_if_fail (console->priv->proxy_manager != NULL, FALSE); |
224 |
|
225 |
ret = dbus_g_proxy_call (console->priv->proxy_manager, "CanSuspend", &error_local, |
226 |
G_TYPE_INVALID, |
227 |
G_TYPE_STRING, &retval, G_TYPE_INVALID); |
228 |
if (!ret) { |
229 |
egg_warning ("Couldn't do CanSuspend: %s", error_local->message); |
230 |
if (error != NULL) |
231 |
*error = g_error_new (1, 0, "%s", error_local->message); |
232 |
g_error_free (error_local); |
233 |
} |
234 |
|
235 |
*can_suspend = g_strcmp0 (retval, "yes") == 0 || |
236 |
g_strcmp0 (retval, "challenge") == 0; |
237 |
|
238 |
g_free (retval); |
239 |
return ret; |
240 |
} |
241 |
|
242 |
/** |
243 |
* egg_console_kit_can_hibernate: |
244 |
**/ |
245 |
|
246 |
gboolean |
247 |
egg_console_kit_can_hibernate (EggConsoleKit *console, gboolean *can_hibernate, GError **error) |
248 |
{ |
249 |
GError *error_local = NULL; |
250 |
gboolean ret; |
251 |
gchar *retval; |
252 |
|
253 |
g_return_val_if_fail (EGG_IS_CONSOLE_KIT (console), FALSE); |
254 |
g_return_val_if_fail (console->priv->proxy_manager != NULL, FALSE); |
255 |
|
256 |
ret = dbus_g_proxy_call (console->priv->proxy_manager, "CanHibernate", &error_local, |
257 |
G_TYPE_INVALID, |
258 |
G_TYPE_STRING, &retval, G_TYPE_INVALID); |
259 |
if (!ret) { |
260 |
egg_warning ("Couldn't do CanHibernate: %s", error_local->message); |
261 |
if (error != NULL) |
262 |
*error = g_error_new (1, 0, "%s", error_local->message); |
263 |
g_error_free (error_local); |
264 |
} |
265 |
|
266 |
*can_hibernate = g_strcmp0 (retval, "yes") == 0 || |
267 |
g_strcmp0 (retval, "challenge") == 0; |
268 |
return ret; |
269 |
} |
270 |
|
271 |
/** |
165 |
* egg_console_kit_is_local: |
272 |
* egg_console_kit_is_local: |
166 |
* |
273 |
* |
167 |
* Return value: Returns whether the session is local |
274 |
* Return value: Returns whether the session is local |