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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
|
<?xml version="1.0" encoding="UTF-8"?>
<node name="/org/freedesktop/ConsoleKit/Manager"
xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd"
>
<interface name="org.freedesktop.ConsoleKit.Manager">
<method name="Restart">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<doc:doc>
<doc:description>
<doc:para>This method initiates a request to restart (ie. reboot) the computer system.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="CanRestart">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="can_restart" type="b" direction="out"/>
<doc:doc>
<doc:description>
<doc:para>This method returns whether the user is authorized to restart the computer system.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="Stop">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<doc:doc>
<doc:description>
<doc:para>This method initiates a request to stop (ie. shutdown) the computer system.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="CanStop">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="can_stop" type="b" direction="out"/>
<doc:doc>
<doc:description>
<doc:para>This method returns whether the user is authorized to shutdown the computer system.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="Suspend">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<doc:doc>
<doc:description>
<doc:para>This method initiates a request to suspend the computer system.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="CanSuspend">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="can_suspend" type="b" direction="out"/>
<doc:doc>
<doc:description>
<doc:para>This method returns whether the computer system is capable of suspending.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="AuthSuspend">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="auth_suspend" type="b" direction="out"/>
<doc:doc>
<doc:description>
<doc:para>This method returns whether the user is authorized to suspend the computer system.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="Hibernate">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<doc:doc>
<doc:description>
<doc:para>This method initiates a request to hibernate the computer system.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="CanHibernate">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="can_hibernate" type="b" direction="out"/>
<doc:doc>
<doc:description>
<doc:para>This method returns whether the computer system is capable of hibernating.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="AuthHibernate">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="auth_hibernate" type="b" direction="out"/>
<doc:doc>
<doc:description>
<doc:para>This method returns whether the user is authorized to hibernate the computer system.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="Inhibit">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="what" type="s" direction="in">
<doc:doc>
<doc:summary>What is a colon-separated list of lock types. The list of lock types are: shutdown, sleep, idle, handle-power-key, handle-suspend-key, handle-hibernate-key. Example: "shutdown:idle"</doc:summary>
</doc:doc>
</arg>
<arg name="who" type="s" direction="in">
<doc:doc>
<doc:summary>Who is a human-readable, descriptive string of who is taking the lock. Example: "Xfburn"</doc:summary>
</doc:doc>
</arg>
<arg name="why" type="s" direction="in">
<doc:doc>
<doc:summary>Why is a human-readable, descriptive string of why the program is taking the lock. Example: "Burning a DVD, interrupting now will ruin the DVD."</doc:summary>
</doc:doc>
</arg>
<arg name="fd" type="h" direction="out">
<doc:doc>
<doc:description>
<doc:para>Returns a file descriptor that encapsulates the lock, or -1 on failure. As soon as the file descriptor is closed (and all its duplicates) the lock is automatically released. If the client dies while the lock is taken it is automatically closed and the lock is automatically released.</doc:para>
</doc:description>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>See this simple example:
<doc:example language="c" title="simple example"><doc:code>
DBusConnection *bus_connection;
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
gint fd = -1;
const char *what = "shutdown:sleep";
const char *who = "Xfburn";
const char *why = "Burning a DVD, interrupting now will ruin the DVD.";
message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit",
"/org/freedesktop/ConsoleKit/Manager",
"org.freedesktop.ConsoleKit.Manager",
"Inhibit");
if (!message)
{
g_warning ("Unable to call Inhibit()");
return fd;
}
if (!dbus_message_append_args (message,
DBUS_TYPE_STRING, &what,
DBUS_TYPE_STRING, &who,
DBUS_TYPE_STRING, &why,
DBUS_TYPE_INVALID))
{
g_warning ("Unable to call Inhibit()");
dbus_message_unref (message);
return fd;
}
reply = dbus_connection_send_with_reply_and_block (bus_connection, message, -1, &error);
if (!reply)
{
g_warning ("Unable to inhibit: %s", error.message);
dbus_message_unref (message);
return fd;
}
if (!dbus_message_get_args (reply, &error,
DBUS_TYPE_UNIX_FD, &fd,
DBUS_TYPE_INVALID))
{
g_warning ("Inhibit() reply parsing failed: %s", error.message);
}
dbus_message_unref (message);
dbus_message_unref (reply);
dbus_error_free (&error);
return fd;
</doc:code></doc:example></doc:para>
</doc:description>
</doc:doc>
</method>
<method name="OpenSession">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="cookie" direction="out" type="s">
<doc:doc>
<doc:summary>The secret cookie that is used to identify the new session</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>This method requests that a new <doc:ref type="interface" to="Session">Session</doc:ref>
be created for the calling process. The properties of this new Session are set automatically
from information collected about the calling process.
</doc:para>
<doc:para>This new session exists until the calling process disconnects from the system bus or
calls <doc:ref type="method" to="Manager.CloseSession">CloseSession()</doc:ref>.
</doc:para>
<doc:para>It is the responsibility of the calling process to set the environment variable
XDG_SESSION_COOKIE to the value of the returned cookie. This cookie should only
be made available to child processes of the caller so that they may be identified
as members of this session.
</doc:para>
<doc:para>See this simple example:
<doc:example language="c" title="simple example"><doc:code>
DBusError error;
DBusMessage *message;
DBusMessage *reply;
message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit",
"/org/freedesktop/ConsoleKit/Manager",
"org.freedesktop.ConsoleKit.Manager",
"OpenSession");
if (message == NULL) {
goto out;
}
dbus_error_init (&error);
reply = dbus_connection_send_with_reply_and_block (connector->connection,
message,
-1,
&error);
if (reply == NULL) {
goto out;
}
dbus_error_init (&error);
if (! dbus_message_get_args (reply,
&error,
DBUS_TYPE_STRING, &cookie,
DBUS_TYPE_INVALID)) {
goto out;
}
</doc:code></doc:example></doc:para>
</doc:description>
<doc:seealso><doc:ref type="method" to="Manager.OpenSessionWithParameters">OpenSessionWithParameters()</doc:ref></doc:seealso>
</doc:doc>
</method>
<method name="OpenSessionWithParameters">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="parameters" direction="in" type="a(sv)">
<doc:doc>
<doc:summary>An array of sets of property names and values</doc:summary>
</doc:doc>
</arg>
<arg name="cookie" direction="out" type="s">
<doc:doc>
<doc:summary>The secret cookie that is used to identify the new session</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>This method requests that a new <doc:ref type="interface" to="Session">Session</doc:ref>
be created for the calling process. The properties of this new Session are from the
parameters provided.
</doc:para>
<doc:para>This new session exists until the calling process disconnects from the system bus or
calls <doc:ref type="method" to="Manager.CloseSession">CloseSession()</doc:ref>.
</doc:para>
<doc:para>It is the responsibility of the calling process to set the environment variable
XDG_SESSION_COOKIE to the value of the returned cookie. This cookie should only
be made available to child processes of the caller so that they may be identified
as members of this session.
</doc:para>
<doc:para>See the <doc:ref type="interface" to="Session">Session</doc:ref> properties for a list of valid parameters.</doc:para>
</doc:description>
<doc:seealso><doc:ref type="interface" to="Session">org.freedesktop.ConsoleKit.Session</doc:ref></doc:seealso>
<doc:permission>This method is restricted to privileged users by D-Bus policy.</doc:permission>
</doc:doc>
</method>
<method name="CloseSession">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="cookie" direction="in" type="s">
<doc:doc>
<doc:summary>The secret cookie that is used to identify the session</doc:summary>
</doc:doc>
</arg>
<arg name="result" direction="out" type="b">
<doc:doc>
<doc:summary>Whether the session was successfully closed</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>This method is used to close the session identified by the supplied cookie.
</doc:para>
<doc:para>The session can only be closed by the same process that opened the session.
</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="GetSeats">
<arg name="seats" direction="out" type="ao">
<doc:doc>
<doc:summary>an array of Seat IDs</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>This gets a list of all the <doc:ref type="interface" to="Seat">Seats</doc:ref>
that are currently present on the system.</doc:para>
<doc:para>Each Seat ID is an D-Bus object path for the object that implements the
<doc:ref type="interface" to="Seat">Seat</doc:ref> interface.</doc:para>
</doc:description>
<doc:seealso><doc:ref type="interface" to="Seat">org.freedesktop.ConsoleKit.Seat</doc:ref></doc:seealso>
</doc:doc>
</method>
<method name="GetSessions">
<arg name="sessions" direction="out" type="ao">
<doc:doc>
<doc:summary>an array of Session IDs</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref>
that are currently present on the system.</doc:para>
<doc:para>Each Session ID is an D-Bus object path for the object that implements the
<doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para>
</doc:description>
<doc:seealso><doc:ref type="interface" to="Session">org.freedesktop.ConsoleKit.Session</doc:ref></doc:seealso>
</doc:doc>
</method>
<method name="GetSessionForCookie">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="cookie" direction="in" type="s">
<doc:doc>
<doc:summary>The secret cookie that is used to identify the session</doc:summary>
</doc:doc>
</arg>
<arg name="ssid" direction="out" type="o">
<doc:doc>
<doc:summary>The object identifier for the current session</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>Returns the session ID that is associated with the specified cookie.
</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="GetSessionForUnixProcess">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="pid" direction="in" type="u">
<doc:doc>
<doc:summary>The POSIX process ID</doc:summary>
</doc:doc>
</arg>
<arg name="ssid" direction="out" type="o">
<doc:doc>
<doc:summary>The object identifier for the current session</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>Attempts to determine the session ID for the specified
POSIX process ID (pid).
</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="GetCurrentSession">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="ssid" direction="out" type="o">
<doc:doc>
<doc:summary>The object identifier for the current session</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>Attempts to determine the session ID that the caller belongs to.
</doc:para>
<doc:para>See this example of using dbus-send:
<doc:example language="shell" title="shell example"><doc:code>
dbus-send --system --dest=org.freedesktop.ConsoleKit \
--type=method_call --print-reply --reply-timeout=2000 \
/org/freedesktop/ConsoleKit/Manager \
org.freedesktop.ConsoleKit.Manager.GetCurrentSession
</doc:code></doc:example></doc:para>
</doc:description>
</doc:doc>
</method>
<method name="GetSessionsForUnixUser">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="uid" direction="in" type="u">
<doc:doc>
<doc:summary>POSIX User identification</doc:summary>
</doc:doc>
</arg>
<arg name="sessions" direction="out" type="ao">
<doc:doc>
<doc:summary>an array of Session IDs</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref>
that are currently open for the specified user.</doc:para>
<doc:para>Each Session ID is an D-Bus object path for the object that implements the
<doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="GetSessionsForUser">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="uid" direction="in" type="u">
<doc:doc>
<doc:summary>User identification</doc:summary>
</doc:doc>
</arg>
<arg name="sessions" direction="out" type="ao">
<doc:doc>
<doc:summary>an array of Session IDs</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref>
that are currently open for the specified user.</doc:para>
<doc:para>Each Session ID is an D-Bus object path for the object that implements the
<doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para>
</doc:description>
<doc:deprecated version="0.1.3" instead="GetSessionsForUnixUser"/>
</doc:doc>
</method>
<method name="GetSystemIdleHint">
<arg name="idle_hint" type="b" direction="out">
<doc:doc>
<doc:summary>The value of the system-idle-hint</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>Returns TRUE if the <doc:ref type="property" to="Session:idle-hint">idle-hint</doc:ref>
property of every open session is TRUE or if there are no open sessions.
</doc:para>
</doc:description>
</doc:doc>
</method>
<method name="GetSystemIdleSinceHint">
<arg name="iso8601_datetime" type="s" direction="out">
<doc:doc>
<doc:summary>An ISO 8601 format date-type string</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>Returns an ISO 8601 date-time string that corresponds to
the time of the last change of the system-idle-hint.
</doc:para>
</doc:description>
</doc:doc>
</method>
<signal name="SeatAdded">
<arg name="sid" type="o">
<doc:doc>
<doc:summary>The Seat ID for the added seat</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>Emitted when a Seat has been added to the system.
</doc:para>
</doc:description>
</doc:doc>
</signal>
<signal name="SeatRemoved">
<arg name="sid" type="o">
<doc:doc>
<doc:summary>The Seat ID for the removed seat</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>Emitted when a Seat has been removed from the system.
</doc:para>
</doc:description>
</doc:doc>
</signal>
<signal name="SystemIdleHintChanged">
<arg name="hint" type="b">
<doc:doc>
<doc:summary>The value of the system-idle-hint</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>Emitted when the value of the system-idle-hint has changed.
</doc:para>
</doc:description>
</doc:doc>
</signal>
</interface>
</node>
|