Merge lp:~laney/indicator-session/logind-port into lp:indicator-session/13.10

Proposed by Iain Lane
Status: Merged
Approved by: Mathieu Trudel-Lapierre
Approved revision: 393
Merged at revision: 388
Proposed branch: lp:~laney/indicator-session/logind-port
Merge into: lp:indicator-session/13.10
Diff against target: 2813 lines (+657/-1650)
14 files modified
src/Makefile.am (+39/-53)
src/dialog.c (+17/-17)
src/gtk-logout-helper.c (+14/-16)
src/org.freedesktop.ConsoleKit.Manager.xml (+0/-353)
src/org.freedesktop.ConsoleKit.Seat.xml (+0/-164)
src/org.freedesktop.ConsoleKit.Session.xml (+0/-435)
src/org.freedesktop.login1.Manager.xml (+199/-0)
src/org.freedesktop.login1.Seat.xml (+21/-0)
src/org.freedesktop.login1.Session.xml (+49/-0)
src/org.freedesktop.login1.User.xml (+56/-0)
src/session-menu-mgr.c (+58/-100)
src/upower.xml (+0/-309)
src/users-service-dbus.c (+202/-200)
src/users-service-dbus.h (+2/-3)
To merge this branch: bzr merge lp:~laney/indicator-session/logind-port
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+160096@code.launchpad.net

Commit message

Stop using ConsoleKit and UPower for session tracking and shutdown/reboot/suspend/hibernate; migrate to logind.

Description of the change

Stop using ConsoleKit and UPower; migrate to logind.

I don't know the proper way to get the .xml files for input to gdbus-codegen so I generated these with gdbus introspect --xml. Hope that's OK, otherwise I'm happy to fix it if someone can tell me what the proper way is. :-)

Style error spotting appreciated. After a while you stop being able to notice such things.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Should get rid of that comment too:

1845 /* maybe the seat doesn't support activation */

The rest looks fine to me.

review: Approve
394. By Iain Lane

Remove stray comment

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Makefile.am'
2--- src/Makefile.am 2012-10-03 19:35:57 +0000
3+++ src/Makefile.am 2013-04-22 12:49:38 +0000
4@@ -43,34 +43,34 @@
5 --generate-c-code dbus-display-manager \
6 $^
7
8-dbus_consolekit_manager_sources = \
9- dbus-consolekit-manager.c \
10- dbus-consolekit-manager.h
11-
12-$(dbus_consolekit_manager_sources): org.freedesktop.ConsoleKit.Manager.xml
13- $(AM_V_GEN) gdbus-codegen \
14- --interface-prefix org.freedesktop \
15- --generate-c-code dbus-consolekit-manager \
16- $^
17-
18-dbus_consolekit_seat_sources = \
19- dbus-consolekit-seat.c \
20- dbus-consolekit-seat.h
21-
22-$(dbus_consolekit_seat_sources): org.freedesktop.ConsoleKit.Seat.xml
23- $(AM_V_GEN) gdbus-codegen \
24- --interface-prefix org.freedesktop \
25- --generate-c-code dbus-consolekit-seat \
26- $^
27-
28-dbus_consolekit_session_sources = \
29- dbus-consolekit-session.c \
30- dbus-consolekit-session.h
31-
32-$(dbus_consolekit_session_sources): org.freedesktop.ConsoleKit.Session.xml
33- $(AM_V_GEN) gdbus-codegen \
34- --interface-prefix org.freedesktop \
35- --generate-c-code dbus-consolekit-session \
36+dbus_login1_manager_sources = \
37+ dbus-login1-manager.c \
38+ dbus-login1-manager.h
39+
40+$(dbus_login1_manager_sources): org.freedesktop.login1.Manager.xml
41+ $(AM_V_GEN) gdbus-codegen \
42+ --interface-prefix org.freedesktop \
43+ --generate-c-code dbus-login1-manager \
44+ $^
45+
46+dbus_login1_session_sources = \
47+ dbus-login1-session.c \
48+ dbus-login1-session.h
49+
50+$(dbus_login1_session_sources): org.freedesktop.login1.Session.xml
51+ $(AM_V_GEN) gdbus-codegen \
52+ --interface-prefix org.freedesktop \
53+ --generate-c-code dbus-login1-session \
54+ $^
55+
56+dbus_login1_user_sources = \
57+ dbus-login1-user.c \
58+ dbus-login1-user.h
59+
60+$(dbus_login1_user_sources): org.freedesktop.login1.User.xml
61+ $(AM_V_GEN) gdbus-codegen \
62+ --interface-prefix org.freedesktop \
63+ --generate-c-code dbus-login1-user \
64 $^
65
66 dbus_accounts_sources = \
67@@ -92,17 +92,6 @@
68 --interface-prefix org.freedesktop \
69 --generate-c-code dbus-user \
70 $^
71-
72-dbus_upower_sources = \
73- dbus-upower.c \
74- dbus-upower.h
75-
76-$(dbus_upower_sources): upower.xml
77- $(AM_V_GEN) gdbus-codegen \
78- --interface-prefix org.freedesktop \
79- --generate-c-code dbus-upower \
80- --c-namespace DBus \
81- $^
82
83 gen-%.xml.c: %.xml
84 @echo "Building $@ from $<"
85@@ -120,11 +109,10 @@
86
87 indicator_session_service_SOURCES = \
88 $(dbus_accounts_sources) \
89- $(dbus_consolekit_manager_sources) \
90- $(dbus_consolekit_seat_sources) \
91- $(dbus_consolekit_session_sources) \
92+ $(dbus_login1_manager_sources) \
93+ $(dbus_login1_user_sources) \
94+ $(dbus_login1_session_sources) \
95 $(dbus_display_manager_sources) \
96- $(dbus_upower_sources) \
97 $(dbus_user_sources) \
98 session-service.c \
99 session-dbus.c \
100@@ -156,7 +144,7 @@
101
102 if BUILD_GTKLOGOUTHELPER
103 gtk_logout_helper_SOURCES = \
104- $(dbus_consolekit_manager_sources) \
105+ $(dbus_login1_manager_sources) \
106 gtk-logout-helper.c \
107 dialog.c \
108 dialog.h
109@@ -185,11 +173,10 @@
110
111 BUILT_SOURCES = \
112 $(dbus_accounts_sources) \
113- $(dbus_consolekit_manager_sources) \
114- $(dbus_consolekit_seat_sources) \
115- $(dbus_consolekit_session_sources) \
116+ $(dbus_login1_manager_sources) \
117+ $(dbus_login1_user_sources) \
118+ $(dbus_login1_session_sources) \
119 $(dbus_display_manager_sources) \
120- $(dbus_upower_sources) \
121 $(dbus_user_sources) \
122 gen-session-dbus.xml.c \
123 gen-session-dbus.xml.h
124@@ -198,10 +185,9 @@
125 display-manager.xml \
126 org.freedesktop.Accounts.User.xml \
127 org.freedesktop.Accounts.xml \
128- org.freedesktop.ConsoleKit.Manager.xml \
129- org.freedesktop.ConsoleKit.Seat.xml \
130- org.freedesktop.ConsoleKit.Session.xml \
131- session-dbus.xml \
132- upower.xml
133+ org.freedesktop.login1.Manager.xml \
134+ org.freedesktop.login1.Session.xml \
135+ org.freedesktop.login1.User.xml \
136+ session-dbus.xml
137
138 CLEANFILES += $(BUILT_SOURCES)
139
140=== modified file 'src/dialog.c'
141--- src/dialog.c 2012-10-03 19:35:57 +0000
142+++ src/dialog.c 2013-04-22 12:49:38 +0000
143@@ -26,7 +26,7 @@
144
145 #include <glib/gi18n.h>
146
147-#include "dbus-consolekit-manager.h"
148+#include "dbus-login1-manager.h"
149 #include "dialog.h"
150
151 /* Strings */
152@@ -133,35 +133,35 @@
153 return g_file_test("/var/run/reboot-required", G_FILE_TEST_EXISTS);
154 }
155
156-/* Checks with console kit to see if we can do what we want */
157+/* Checks with logind to see if we can do what we want */
158 static gboolean
159-ck_check_allowed (LogoutDialogType type)
160+logind_check_allowed (LogoutDialogType type)
161 {
162- gboolean allowed = TRUE;
163+ gchar * allowed = NULL;
164
165- ConsoleKitManager * ck_proxy = console_kit_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
166- G_DBUS_PROXY_FLAGS_NONE,
167- "org.freedesktop.ConsoleKit",
168- "/org/freedesktop/ConsoleKit/Manager",
169- NULL,
170- NULL);
171- if (ck_proxy != NULL)
172+ Login1Manager * manager_proxy = login1_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
173+ G_DBUS_PROXY_FLAGS_NONE,
174+ "org.freedesktop.login1",
175+ "/org/freedesktop/login1",
176+ NULL,
177+ NULL);
178+ if (manager_proxy != NULL)
179 {
180 switch (type) {
181 case LOGOUT_DIALOG_TYPE_RESTART:
182- console_kit_manager_call_can_restart_sync (ck_proxy, &allowed, NULL, NULL);
183+ login1_manager_call_can_reboot_sync (manager_proxy, &allowed, NULL, NULL);
184 break;
185 case LOGOUT_DIALOG_TYPE_SHUTDOWN:
186- console_kit_manager_call_can_stop_sync (ck_proxy, &allowed, NULL, NULL);
187+ login1_manager_call_can_power_off_sync (manager_proxy, &allowed, NULL, NULL);
188 break;
189 default:
190 break;
191 }
192
193- g_object_unref(ck_proxy);
194+ g_object_unref(manager_proxy);
195 }
196
197- return allowed;
198+ return g_strcmp0 (allowed, "yes") == 0;
199 }
200
201 LogoutDialog *
202@@ -188,9 +188,9 @@
203
204 gboolean allowed = FALSE;
205 if (type == LOGOUT_DIALOG_TYPE_LOG_OUT) {
206- allowed = ck_check_allowed(LOGOUT_DIALOG_TYPE_RESTART);
207+ allowed = logind_check_allowed(LOGOUT_DIALOG_TYPE_RESTART);
208 } else {
209- allowed = ck_check_allowed(type);
210+ allowed = logind_check_allowed(type);
211 }
212
213 gboolean restart_required = FALSE;
214
215=== modified file 'src/gtk-logout-helper.c'
216--- src/gtk-logout-helper.c 2012-11-29 22:09:57 +0000
217+++ src/gtk-logout-helper.c 2013-04-22 12:49:38 +0000
218@@ -31,7 +31,7 @@
219 #include "shared-names.h"
220
221 static GVariant *
222-call_console_kit (const gchar *method, GVariant *parameters, GError **error)
223+call_logind (const gchar *method, GVariant *parameters, GError **error)
224 {
225 GDBusConnection * bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, error);
226 if (!bus)
227@@ -41,9 +41,9 @@
228 }
229
230 GVariant *result = g_dbus_connection_call_sync(bus,
231- "org.freedesktop.ConsoleKit",
232- "/org/freedesktop/ConsoleKit/Manager",
233- "org.freedesktop.ConsoleKit.Manager",
234+ "org.freedesktop.login1",
235+ "/org/freedesktop/login1",
236+ "org.freedesktop.login1.Manager",
237 method,
238 parameters,
239 NULL,
240@@ -57,24 +57,24 @@
241 }
242
243 static void
244-consolekit_fallback (LogoutDialogType action)
245+logind_fallback (LogoutDialogType action)
246 {
247 GError * error = NULL;
248 GVariant *result = NULL;
249
250- g_debug("Falling back to using ConsoleKit for action");
251+ g_debug("Falling back to using logind for action");
252
253 switch (action) {
254 case LOGOUT_DIALOG_TYPE_LOG_OUT:
255- g_warning("Unable to fallback to ConsoleKit for logout as it's a session issue. We need some sort of session handler.");
256+ g_warning("Unable to fallback to logind for logout as it's a session issue. We need some sort of session handler.");
257 break;
258 case LOGOUT_DIALOG_TYPE_SHUTDOWN:
259- g_debug("Telling ConsoleKit to 'Stop'");
260- result = call_console_kit ("Stop", g_variant_new ("()"), &error);
261+ g_debug("Telling logind to 'PowerOff'");
262+ result = call_logind ("PowerOff", g_variant_new ("(b)", FALSE), &error);
263 break;
264 case LOGOUT_DIALOG_TYPE_RESTART:
265- g_debug("Telling ConsoleKit to 'Restart'");
266- result = call_console_kit ("Restart", g_variant_new ("()"), &error);
267+ g_debug("Telling logind to 'Reboot'");
268+ result = call_logind ("Reboot", g_variant_new ("(b)", FALSE), &error);
269 break;
270 default:
271 g_warning("Unknown action");
272@@ -83,12 +83,10 @@
273
274 if (!result) {
275 if (error != NULL) {
276- g_warning ("ConsoleKit action failed: %s", error->message);
277+ g_warning ("logind action failed: %s", error->message);
278 } else {
279- g_warning ("ConsoleKit action failed: unknown error");
280+ g_warning ("logind action failed: unknown error");
281 }
282-
283- consolekit_fallback(action);
284 }
285 else
286 g_variant_unref (result);
287@@ -149,7 +147,7 @@
288 g_warning ("SessionManager action failed: unknown error");
289 }
290
291- consolekit_fallback(action);
292+ logind_fallback(action);
293 }
294 else
295 g_variant_unref (result);
296
297=== removed file 'src/org.freedesktop.ConsoleKit.Manager.xml'
298--- src/org.freedesktop.ConsoleKit.Manager.xml 2011-08-17 20:53:51 +0000
299+++ src/org.freedesktop.ConsoleKit.Manager.xml 1970-01-01 00:00:00 +0000
300@@ -1,353 +0,0 @@
301-<?xml version="1.0" encoding="UTF-8"?>
302-<node name="/org/freedesktop/ConsoleKit/Manager"
303- xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd"
304->
305-
306- <interface name="org.freedesktop.ConsoleKit.Manager">
307- <method name="Restart">
308- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
309- <doc:doc>
310- <doc:description>
311- <doc:para>This method initiates a request to restart (ie. reboot) the computer system.</doc:para>
312- </doc:description>
313- </doc:doc>
314- </method>
315-
316- <method name="CanRestart">
317- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
318- <arg name="can_restart" type="b" direction="out"/>
319- </method>
320-
321- <method name="Stop">
322- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
323- <doc:doc>
324- <doc:description>
325- <doc:para>This method initiates a request to stop (ie. shutdown) the computer system.</doc:para>
326- </doc:description>
327- </doc:doc>
328- </method>
329-
330- <method name="CanStop">
331- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
332- <arg name="can_stop" type="b" direction="out"/>
333- </method>
334-
335- <method name="OpenSession">
336- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
337- <arg name="cookie" direction="out" type="s">
338- <doc:doc>
339- <doc:summary>The secret cookie that is used to identify the new session</doc:summary>
340- </doc:doc>
341- </arg>
342- <doc:doc>
343- <doc:description>
344- <doc:para>This method requests that a new <doc:ref type="interface" to="Session">Session</doc:ref>
345- be created for the calling process. The properties of this new Session are set automatically
346- from information collected about the calling process.
347- </doc:para>
348- <doc:para>This new session exists until the calling process disconnects from the system bus or
349- calls <doc:ref type="method" to="Manager.CloseSession">CloseSession()</doc:ref>.
350- </doc:para>
351- <doc:para>It is the responsibility of the calling process to set the environment variable
352- XDG_SESSION_COOKIE to the value of the returned cookie. This cookie should only
353- be made available to child processes of the caller so that they may be identified
354- as members of this session.
355- </doc:para>
356- <doc:para>See this simple example:
357- <doc:example language="c" title="simple example"><doc:code>
358- DBusError error;
359- DBusMessage *message;
360- DBusMessage *reply;
361-
362- message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit",
363- "/org/freedesktop/ConsoleKit/Manager",
364- "org.freedesktop.ConsoleKit.Manager",
365- "OpenSession");
366- if (message == NULL) {
367- goto out;
368- }
369-
370- dbus_error_init (&amp;error);
371- reply = dbus_connection_send_with_reply_and_block (connector->connection,
372- message,
373- -1,
374- &amp;error);
375- if (reply == NULL) {
376- goto out;
377- }
378-
379- dbus_error_init (&amp;error);
380- if (! dbus_message_get_args (reply,
381- &amp;error,
382- DBUS_TYPE_STRING, &amp;cookie,
383- DBUS_TYPE_INVALID)) {
384- goto out;
385- }
386-
387- </doc:code></doc:example></doc:para>
388- </doc:description>
389- <doc:seealso><doc:ref type="method" to="Manager.OpenSessionWithParameters">OpenSessionWithParameters()</doc:ref></doc:seealso>
390- </doc:doc>
391- </method>
392- <method name="OpenSessionWithParameters">
393- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
394- <arg name="parameters" direction="in" type="a(sv)">
395- <doc:doc>
396- <doc:summary>An array of sets of property names and values</doc:summary>
397- </doc:doc>
398- </arg>
399- <arg name="cookie" direction="out" type="s">
400- <doc:doc>
401- <doc:summary>The secret cookie that is used to identify the new session</doc:summary>
402- </doc:doc>
403- </arg>
404- <doc:doc>
405- <doc:description>
406- <doc:para>This method requests that a new <doc:ref type="interface" to="Session">Session</doc:ref>
407- be created for the calling process. The properties of this new Session are from the
408- parameters provided.
409- </doc:para>
410- <doc:para>This new session exists until the calling process disconnects from the system bus or
411- calls <doc:ref type="method" to="Manager.CloseSession">CloseSession()</doc:ref>.
412- </doc:para>
413- <doc:para>It is the responsibility of the calling process to set the environment variable
414- XDG_SESSION_COOKIE to the value of the returned cookie. This cookie should only
415- be made available to child processes of the caller so that they may be identified
416- as members of this session.
417- </doc:para>
418- <doc:para>See the <doc:ref type="interface" to="Session">Session</doc:ref> properties for a list of valid parameters.</doc:para>
419- </doc:description>
420- <doc:seealso><doc:ref type="interface" to="Session">org.freedesktop.ConsoleKit.Session</doc:ref></doc:seealso>
421- <doc:permission>This method is restricted to privileged users by D-Bus policy.</doc:permission>
422- </doc:doc>
423- </method>
424- <method name="CloseSession">
425- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
426- <arg name="cookie" direction="in" type="s">
427- <doc:doc>
428- <doc:summary>The secret cookie that is used to identify the session</doc:summary>
429- </doc:doc>
430- </arg>
431- <arg name="result" direction="out" type="b">
432- <doc:doc>
433- <doc:summary>Whether the session was successfully closed</doc:summary>
434- </doc:doc>
435- </arg>
436- <doc:doc>
437- <doc:description>
438- <doc:para>This method is used to close the session identified by the supplied cookie.
439- </doc:para>
440- <doc:para>The session can only be closed by the same process that opened the session.
441- </doc:para>
442- </doc:description>
443- </doc:doc>
444- </method>
445-
446- <method name="GetSeats">
447- <arg name="seats" direction="out" type="ao">
448- <doc:doc>
449- <doc:summary>an array of Seat IDs</doc:summary>
450- </doc:doc>
451- </arg>
452- <doc:doc>
453- <doc:description>
454- <doc:para>This gets a list of all the <doc:ref type="interface" to="Seat">Seats</doc:ref>
455- that are currently present on the system.</doc:para>
456- <doc:para>Each Seat ID is an D-Bus object path for the object that implements the
457- <doc:ref type="interface" to="Seat">Seat</doc:ref> interface.</doc:para>
458- </doc:description>
459- <doc:seealso><doc:ref type="interface" to="Seat">org.freedesktop.ConsoleKit.Seat</doc:ref></doc:seealso>
460- </doc:doc>
461- </method>
462-
463- <method name="GetSessions">
464- <arg name="sessions" direction="out" type="ao">
465- <doc:doc>
466- <doc:summary>an array of Session IDs</doc:summary>
467- </doc:doc>
468- </arg>
469- <doc:doc>
470- <doc:description>
471- <doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref>
472- that are currently present on the system.</doc:para>
473- <doc:para>Each Session ID is an D-Bus object path for the object that implements the
474- <doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para>
475- </doc:description>
476- <doc:seealso><doc:ref type="interface" to="Session">org.freedesktop.ConsoleKit.Session</doc:ref></doc:seealso>
477- </doc:doc>
478- </method>
479-
480- <method name="GetSessionForCookie">
481- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
482- <arg name="cookie" direction="in" type="s">
483- <doc:doc>
484- <doc:summary>The secret cookie that is used to identify the session</doc:summary>
485- </doc:doc>
486- </arg>
487- <arg name="ssid" direction="out" type="o">
488- <doc:doc>
489- <doc:summary>The object identifier for the current session</doc:summary>
490- </doc:doc>
491- </arg>
492- <doc:doc>
493- <doc:description>
494- <doc:para>Returns the session ID that is associated with the specified cookie.
495- </doc:para>
496- </doc:description>
497- </doc:doc>
498- </method>
499- <method name="GetSessionForUnixProcess">
500- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
501- <arg name="pid" direction="in" type="u">
502- <doc:doc>
503- <doc:summary>The POSIX process ID</doc:summary>
504- </doc:doc>
505- </arg>
506- <arg name="ssid" direction="out" type="o">
507- <doc:doc>
508- <doc:summary>The object identifier for the current session</doc:summary>
509- </doc:doc>
510- </arg>
511- <doc:doc>
512- <doc:description>
513- <doc:para>Attempts to determine the session ID for the specified
514- POSIX process ID (pid).
515- </doc:para>
516- </doc:description>
517- </doc:doc>
518- </method>
519- <method name="GetCurrentSession">
520- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
521- <arg name="ssid" direction="out" type="o">
522- <doc:doc>
523- <doc:summary>The object identifier for the current session</doc:summary>
524- </doc:doc>
525- </arg>
526- <doc:doc>
527- <doc:description>
528- <doc:para>Attempts to determine the session ID that the caller belongs to.
529- </doc:para>
530- <doc:para>See this example of using dbus-send:
531- <doc:example language="shell" title="shell example"><doc:code>
532- dbus-send --system --dest=org.freedesktop.ConsoleKit \
533- --type=method_call --print-reply --reply-timeout=2000 \
534- /org/freedesktop/ConsoleKit/Manager \
535- org.freedesktop.ConsoleKit.Manager.GetCurrentSession
536- </doc:code></doc:example></doc:para>
537- </doc:description>
538- </doc:doc>
539- </method>
540- <method name="GetSessionsForUnixUser">
541- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
542- <arg name="uid" direction="in" type="u">
543- <doc:doc>
544- <doc:summary>POSIX User identification</doc:summary>
545- </doc:doc>
546- </arg>
547- <arg name="sessions" direction="out" type="ao">
548- <doc:doc>
549- <doc:summary>an array of Session IDs</doc:summary>
550- </doc:doc>
551- </arg>
552- <doc:doc>
553- <doc:description>
554- <doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref>
555- that are currently open for the specified user.</doc:para>
556- <doc:para>Each Session ID is an D-Bus object path for the object that implements the
557- <doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para>
558- </doc:description>
559- </doc:doc>
560- </method>
561- <method name="GetSessionsForUser">
562- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
563- <arg name="uid" direction="in" type="u">
564- <doc:doc>
565- <doc:summary>User identification</doc:summary>
566- </doc:doc>
567- </arg>
568- <arg name="sessions" direction="out" type="ao">
569- <doc:doc>
570- <doc:summary>an array of Session IDs</doc:summary>
571- </doc:doc>
572- </arg>
573- <doc:doc>
574- <doc:description>
575- <doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref>
576- that are currently open for the specified user.</doc:para>
577- <doc:para>Each Session ID is an D-Bus object path for the object that implements the
578- <doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para>
579- </doc:description>
580- <doc:deprecated version="0.1.3" instead="GetSessionsForUnixUser"/>
581- </doc:doc>
582- </method>
583-
584- <method name="GetSystemIdleHint">
585- <arg name="idle_hint" type="b" direction="out">
586- <doc:doc>
587- <doc:summary>The value of the system-idle-hint</doc:summary>
588- </doc:doc>
589- </arg>
590- <doc:doc>
591- <doc:description>
592- <doc:para>Returns TRUE if the <doc:ref type="property" to="Session:idle-hint">idle-hint</doc:ref>
593- property of every open session is TRUE or if there are no open sessions.
594- </doc:para>
595- </doc:description>
596- </doc:doc>
597- </method>
598- <method name="GetSystemIdleSinceHint">
599- <arg name="iso8601_datetime" type="s" direction="out">
600- <doc:doc>
601- <doc:summary>An ISO 8601 format date-type string</doc:summary>
602- </doc:doc>
603- </arg>
604- <doc:doc>
605- <doc:description>
606- <doc:para>Returns an ISO 8601 date-time string that corresponds to
607- the time of the last change of the system-idle-hint.
608- </doc:para>
609- </doc:description>
610- </doc:doc>
611- </method>
612-
613- <signal name="SeatAdded">
614- <arg name="sid" type="o">
615- <doc:doc>
616- <doc:summary>The Seat ID for the added seat</doc:summary>
617- </doc:doc>
618- </arg>
619- <doc:doc>
620- <doc:description>
621- <doc:para>Emitted when a Seat has been added to the system.
622- </doc:para>
623- </doc:description>
624- </doc:doc>
625- </signal>
626- <signal name="SeatRemoved">
627- <arg name="sid" type="o">
628- <doc:doc>
629- <doc:summary>The Seat ID for the removed seat</doc:summary>
630- </doc:doc>
631- </arg>
632- <doc:doc>
633- <doc:description>
634- <doc:para>Emitted when a Seat has been removed from the system.
635- </doc:para>
636- </doc:description>
637- </doc:doc>
638- </signal>
639- <signal name="SystemIdleHintChanged">
640- <arg name="hint" type="b">
641- <doc:doc>
642- <doc:summary>The value of the system-idle-hint</doc:summary>
643- </doc:doc>
644- </arg>
645- <doc:doc>
646- <doc:description>
647- <doc:para>Emitted when the value of the system-idle-hint has changed.
648- </doc:para>
649- </doc:description>
650- </doc:doc>
651- </signal>
652- </interface>
653-</node>
654
655=== removed file 'src/org.freedesktop.ConsoleKit.Seat.xml'
656--- src/org.freedesktop.ConsoleKit.Seat.xml 2012-06-12 05:39:31 +0000
657+++ src/org.freedesktop.ConsoleKit.Seat.xml 1970-01-01 00:00:00 +0000
658@@ -1,164 +0,0 @@
659-<?xml version="1.0" encoding="UTF-8"?>
660-<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
661-
662- <interface name="org.freedesktop.ConsoleKit.Seat">
663- <doc:doc>
664- <doc:description>
665- <doc:para>A seat is a collection of sessions and a set of hardware (usually at
666-least a keyboard and mouse). Only one session may be active on a
667-seat at a time.</doc:para>
668- </doc:description>
669- </doc:doc>
670-
671- <method name="GetId">
672- <arg name="sid" direction="out" type="o">
673- <doc:doc>
674- <doc:summary>Seat ID</doc:summary>
675- </doc:doc>
676- </arg>
677- <doc:doc>
678- <doc:description>
679- <doc:para>Returns the ID for Seat.</doc:para>
680- </doc:description>
681- </doc:doc>
682- </method>
683-
684- <method name="GetSessions">
685- <arg name="sessions" direction="out" type="ao">
686- <doc:doc>
687- <doc:summary>an array of Session IDs</doc:summary>
688- </doc:doc>
689- </arg>
690- <doc:doc>
691- <doc:description>
692- <doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref>
693- that are currently attached to this seat.</doc:para>
694- <doc:para>Each Session ID is an D-Bus object path for the object that implements the
695- <doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para>
696- </doc:description>
697- </doc:doc>
698- </method>
699-
700- <method name="GetDevices">
701- <arg name="devices" direction="out" type="a(ss)">
702- <doc:doc>
703- <doc:summary>an array of devices</doc:summary>
704- </doc:doc>
705- </arg>
706- <doc:doc>
707- <doc:description>
708- <doc:para>This gets a list of all the devices
709- that are currently associated with this seat.</doc:para>
710- <doc:para>Each device is an D-Bus structure that represents
711- the device type and the device id.
712- </doc:para>
713- </doc:description>
714- </doc:doc>
715- </method>
716-
717- <method name="GetActiveSession">
718- <arg name="ssid" direction="out" type="o">
719- <doc:doc>
720- <doc:summary>Session ID</doc:summary>
721- </doc:doc>
722- </arg>
723- <doc:doc>
724- <doc:description>
725- <doc:para>Gets the Session ID that is currently active on this Seat.</doc:para>
726- <doc:para>Returns NULL if there is no active session.</doc:para>
727- </doc:description>
728- </doc:doc>
729- </method>
730-
731- <method name="CanActivateSessions">
732- <arg name="can_activate" direction="out" type="b">
733- <doc:doc>
734- <doc:summary>TRUE if seat supports session activation</doc:summary>
735- </doc:doc>
736- </arg>
737- <doc:doc>
738- <doc:description><doc:para>Used to determine whether the seat supports session activation.</doc:para>
739- </doc:description>
740- </doc:doc>
741- </method>
742-
743- <method name="ActivateSession">
744- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
745- <arg name="ssid" direction="in" type="o">
746- <doc:doc>
747- <doc:summary>Session ID</doc:summary>
748- </doc:doc>
749- </arg>
750- <doc:doc>
751- <doc:description>
752- <doc:para>Attempt to activate the specified session. In most
753- cases, if successful, this will cause the session to
754- become visible and take control of the hardware that is
755- associated with this seat.</doc:para>
756- </doc:description>
757- <doc:seealso><doc:ref type="method" to="Session.Activate">Activate()</doc:ref></doc:seealso>
758- </doc:doc>
759- </method>
760-
761- <signal name="ActiveSessionChanged">
762- <arg name="ssid" type="s">
763- <doc:doc>
764- <doc:summary>Session ID</doc:summary>
765- </doc:doc>
766- </arg>
767- <doc:doc>
768- <doc:description>
769- <doc:para>Emitted when the active session has changed.</doc:para>
770- </doc:description>
771- </doc:doc>
772- </signal>
773- <signal name="SessionAdded">
774- <arg name="ssid" type="o">
775- <doc:doc>
776- <doc:summary>Session ID</doc:summary>
777- </doc:doc>
778- </arg>
779- <doc:doc>
780- <doc:description>
781- <doc:para>Emitted when a session has been added to the seat.</doc:para>
782- </doc:description>
783- </doc:doc>
784- </signal>
785- <signal name="SessionRemoved">
786- <arg name="ssid" type="o">
787- <doc:doc>
788- <doc:summary>Session ID</doc:summary>
789- </doc:doc>
790- </arg>
791- <doc:doc>
792- <doc:description>
793- <doc:para>Emitted when a session has been removed from the seat.</doc:para>
794- </doc:description>
795- </doc:doc>
796- </signal>
797- <signal name="DeviceAdded">
798- <arg name="device" type="(ss)">
799- <doc:doc>
800- <doc:summary>Device structure</doc:summary>
801- </doc:doc>
802- </arg>
803- <doc:doc>
804- <doc:description>
805- <doc:para>Emitted when a device has been associated with the seat.</doc:para>
806- </doc:description>
807- </doc:doc>
808- </signal>
809- <signal name="DeviceRemoved">
810- <arg name="device" type="(ss)">
811- <doc:doc>
812- <doc:summary>Device structure</doc:summary>
813- </doc:doc>
814- </arg>
815- <doc:doc>
816- <doc:description>
817- <doc:para>Emitted when a device has been dissociated from the seat.</doc:para>
818- </doc:description>
819- </doc:doc>
820- </signal>
821- </interface>
822-</node>
823
824=== removed file 'src/org.freedesktop.ConsoleKit.Session.xml'
825--- src/org.freedesktop.ConsoleKit.Session.xml 2011-08-17 20:53:51 +0000
826+++ src/org.freedesktop.ConsoleKit.Session.xml 1970-01-01 00:00:00 +0000
827@@ -1,435 +0,0 @@
828-<?xml version="1.0" encoding="UTF-8"?>
829-<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
830-
831- <interface name="org.freedesktop.ConsoleKit.Session">
832- <doc:doc>
833- <doc:description>
834- <doc:para>Session objects represent and store information
835- related to a user session.
836- </doc:para>
837- <doc:para>The properties associated with the Session
838- specifically refer to the properties of the "session leader".
839- </doc:para>
840- </doc:description>
841- </doc:doc>
842- <method name="GetId">
843- <arg name="ssid" direction="out" type="o">
844- <doc:doc>
845- <doc:summary>Session ID</doc:summary>
846- </doc:doc>
847- </arg>
848- <doc:doc>
849- <doc:description><doc:para>Returns the ID for Session.</doc:para>
850- </doc:description>
851- </doc:doc>
852- </method>
853- <method name="GetSeatId">
854- <arg name="sid" direction="out" type="o">
855- <doc:doc>
856- <doc:summary>Seat ID</doc:summary>
857- </doc:doc>
858- </arg>
859- <doc:doc>
860- <doc:description><doc:para>Returns the ID for the Seat the Session is
861- attached to.</doc:para>
862- </doc:description>
863- <doc:seealso><doc:ref type="interface" to="Seat">org.freedesktop.ConsoleKit.Seat</doc:ref></doc:seealso>
864- </doc:doc>
865- </method>
866- <method name="GetSessionType">
867- <arg name="type" direction="out" type="s">
868- <doc:doc>
869- <doc:summary>Session type</doc:summary>
870- </doc:doc>
871- </arg>
872- <doc:doc>
873- <doc:description>
874- <doc:para>Returns the type of the session.</doc:para>
875- <doc:para>Warning: we haven't yet defined the allowed values for this property.
876- It is probably best to avoid this until we do.
877- </doc:para>
878- </doc:description>
879- <doc:seealso><doc:ref type="property" to="Session:session-type">session-type</doc:ref></doc:seealso>
880- </doc:doc>
881- </method>
882- <method name="GetUser">
883- <arg name="uid" direction="out" type="u">
884- <doc:doc>
885- <doc:summary>User ID</doc:summary>
886- </doc:doc>
887- </arg>
888- <doc:doc>
889- <doc:description><doc:para>Returns the user that the session belongs to.</doc:para>
890- </doc:description>
891- <doc:deprecated version="0.1.3" instead="GetUnixUser"/>
892- <doc:seealso><doc:ref type="property" to="Session:user">user</doc:ref></doc:seealso>
893- </doc:doc>
894- </method>
895- <method name="GetUnixUser">
896- <arg name="uid" direction="out" type="u">
897- <doc:doc>
898- <doc:summary>POSIX User ID</doc:summary>
899- </doc:doc>
900- </arg>
901- <doc:doc>
902- <doc:description><doc:para>Returns the POSIX user ID that the session belongs to.</doc:para>
903- </doc:description>
904- <doc:seealso><doc:ref type="property" to="Session:unix-user">unix-user</doc:ref></doc:seealso>
905- </doc:doc>
906- </method>
907- <method name="GetX11Display">
908- <arg name="display" direction="out" type="s">
909- <doc:doc>
910- <doc:summary>The value of the X11 display</doc:summary>
911- </doc:doc>
912- </arg>
913- <doc:doc>
914- <doc:description><doc:para>Returns the value of the X11 DISPLAY for this session
915- if one is present.</doc:para>
916- </doc:description>
917- <doc:seealso><doc:ref type="property" to="Session:x11-display">x11-display</doc:ref></doc:seealso>
918- </doc:doc>
919- </method>
920- <method name="GetX11DisplayDevice">
921- <arg name="x11_display_device" direction="out" type="s">
922- <doc:doc>
923- <doc:summary>The value of the X11 display device</doc:summary>
924- </doc:doc>
925- </arg>
926- <doc:doc>
927- <doc:description><doc:para>Returns the value of the display device (aka TTY) that the
928- X11 display for the session is connected to. If there is no x11-display set then this value
929- is undefined.</doc:para>
930- </doc:description>
931- <doc:seealso><doc:ref type="property" to="Session:x11-display-device">x11-display-device</doc:ref></doc:seealso>
932- </doc:doc>
933- </method>
934- <method name="GetDisplayDevice">
935- <arg name="display_device" direction="out" type="s">
936- <doc:doc>
937- <doc:summary>The value of the display device</doc:summary>
938- </doc:doc>
939- </arg>
940- <doc:doc>
941- <doc:description><doc:para>Returns the value of the display device (aka TTY) that the
942- session is connected to.</doc:para>
943- </doc:description>
944- <doc:seealso><doc:ref type="property" to="Session:display-device">display-device</doc:ref></doc:seealso>
945- </doc:doc>
946- </method>
947- <method name="GetRemoteHostName">
948- <arg name="remote_host_name" direction="out" type="s">
949- <doc:doc>
950- <doc:summary>The remote host name</doc:summary>
951- </doc:doc>
952- </arg>
953- <doc:doc>
954- <doc:description><doc:para>Returns the value of the remote host name for the session.
955- </doc:para>
956- </doc:description>
957- <doc:seealso><doc:ref type="property" to="Session:remote-host-name">remote-host-name</doc:ref></doc:seealso>
958- </doc:doc>
959- </method>
960- <method name="GetLoginSessionId">
961- <arg name="login_session_id" direction="out" type="s">
962- <doc:doc>
963- <doc:summary>The value of the native system login session ID</doc:summary>
964- </doc:doc>
965- </arg>
966- <doc:doc>
967- <doc:description><doc:para>Returns the value of the login session ID that the
968- underlying system uses to enforce session boundaries. If there is no login session ID
969- set then this value is an empty string.</doc:para>
970- </doc:description>
971- </doc:doc>
972- </method>
973- <method name="IsActive">
974- <arg name="active" direction="out" type="b">
975- <doc:doc>
976- <doc:summary>TRUE if the session is active, otherwise FALSE</doc:summary>
977- </doc:doc>
978- </arg>
979- <doc:doc>
980- <doc:description><doc:para>Returns whether the session is active on the Seat that
981- it is attached to.</doc:para>
982- <doc:para>If the session is not attached to a seat this value is undefined.
983- </doc:para>
984- </doc:description>
985- <doc:seealso><doc:ref type="property" to="Session:active">active</doc:ref></doc:seealso>
986- </doc:doc>
987- </method>
988- <method name="IsLocal">
989- <arg name="local" direction="out" type="b">
990- <doc:doc>
991- <doc:summary>TRUE if the session is local, otherwise FALSE</doc:summary>
992- </doc:doc>
993- </arg>
994- <doc:doc>
995- <doc:description><doc:para>Returns whether the session is local</doc:para>
996- <doc:para>FIXME: we need to come up with a concrete definition for this value.
997- It was originally used as a way to identify XDMCP sessions that originate
998- from a remote system.
999- </doc:para>
1000- </doc:description>
1001- <doc:seealso><doc:ref type="property" to="Session:is-local">is-local</doc:ref></doc:seealso>
1002- </doc:doc>
1003- </method>
1004- <method name="GetCreationTime">
1005- <arg name="iso8601_datetime" type="s" direction="out">
1006- <doc:doc>
1007- <doc:summary>An ISO 8601 format date-type string</doc:summary>
1008- </doc:doc>
1009- </arg>
1010- <doc:doc>
1011- <doc:description>
1012- <doc:para>Returns an ISO 8601 date-time string that corresponds to
1013- the time that the session was opened.
1014- </doc:para>
1015- </doc:description>
1016- </doc:doc>
1017- </method>
1018-
1019- <method name="Activate">
1020- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
1021- <doc:doc>
1022- <doc:description>
1023- <doc:para>Attempt to activate the this session. In most
1024- cases, if successful, this will cause the session to
1025- become visible and become active on the seat that it
1026- is attached to.</doc:para>
1027- </doc:description>
1028- <doc:seealso><doc:ref type="method" to="Seat.ActivateSession">Seat.ActivateSession()</doc:ref></doc:seealso>
1029- </doc:doc>
1030- </method>
1031- <method name="Lock">
1032- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
1033- <doc:doc>
1034- <doc:description>
1035- <doc:para>This will cause a <doc:ref type="signal" to="Session::Lock">Lock</doc:ref>
1036- signal to be emitted for this session.
1037- </doc:para>
1038- </doc:description>
1039- <doc:permission>This method is restricted to privileged users by D-Bus policy.</doc:permission>
1040- <doc:seealso><doc:ref type="signal" to="Session::Lock">Lock signal</doc:ref></doc:seealso>
1041- </doc:doc>
1042- </method>
1043- <method name="Unlock">
1044- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
1045- <doc:doc>
1046- <doc:description>
1047- <doc:para>This will cause an <doc:ref type="signal" to="Session::Unlock">Unlock</doc:ref>
1048- signal to be emitted for this session.
1049- </doc:para>
1050- <doc:para>This can be used by login managers to unlock a session before it is
1051- re-activated during fast-user-switching.
1052- </doc:para>
1053- </doc:description>
1054- <doc:permission>This method is restricted to privileged users by D-Bus policy.</doc:permission>
1055- <doc:seealso><doc:ref type="signal" to="Session::Unlock">Unlock signal</doc:ref></doc:seealso>
1056- </doc:doc>
1057- </method>
1058-
1059- <method name="GetIdleHint">
1060- <arg name="idle_hint" type="b" direction="out">
1061- <doc:doc>
1062- <doc:summary>The value of the idle-hint</doc:summary>
1063- </doc:doc>
1064- </arg>
1065- <doc:doc>
1066- <doc:description>
1067- <doc:para>Gets the value of the <doc:ref type="property" to="Session:idle-hint">idle-hint</doc:ref>
1068- property.
1069- </doc:para>
1070- </doc:description>
1071- <doc:seealso><doc:ref type="property" to="Session:idle-hint">idle-hint</doc:ref></doc:seealso>
1072- </doc:doc>
1073- </method>
1074- <method name="GetIdleSinceHint">
1075- <arg name="iso8601_datetime" type="s" direction="out">
1076- <doc:doc>
1077- <doc:summary>An ISO 8601 format date-type string</doc:summary>
1078- </doc:doc>
1079- </arg>
1080- <doc:doc>
1081- <doc:description>
1082- <doc:para>Returns an ISO 8601 date-time string that corresponds to
1083- the time of the last change of the idle-hint.
1084- </doc:para>
1085- </doc:description>
1086- </doc:doc>
1087- </method>
1088- <method name="SetIdleHint">
1089- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
1090- <arg name="idle_hint" type="b" direction="in">
1091- <doc:doc>
1092- <doc:summary>boolean value to set the idle-hint to</doc:summary>
1093- </doc:doc>
1094- </arg>
1095- <doc:doc>
1096- <doc:description>
1097- <doc:para>This may be used by the session to indicate that
1098- it is idle.
1099- </doc:para>
1100- <doc:para>Use of this method is restricted to the user
1101- that owns the session.</doc:para>
1102- </doc:description>
1103- </doc:doc>
1104- </method>
1105-
1106- <signal name="ActiveChanged">
1107- <arg name="is_active" type="b">
1108- <doc:doc>
1109- <doc:summary>TRUE if the session is active, otherwise FALSE</doc:summary>
1110- </doc:doc>
1111- </arg>
1112- <doc:doc>
1113- <doc:description>
1114- <doc:para>Emitted when the active property has changed.</doc:para>
1115- </doc:description>
1116- </doc:doc>
1117- </signal>
1118- <signal name="IdleHintChanged">
1119- <arg name="hint" type="b">
1120- <doc:doc>
1121- <doc:summary>the new value of idle-hint</doc:summary>
1122- </doc:doc>
1123- </arg>
1124- <doc:doc>
1125- <doc:description>
1126- <doc:para>Emitted when the idle-hint property has changed.</doc:para>
1127- </doc:description>
1128- </doc:doc>
1129- </signal>
1130- <signal name="Lock">
1131- <doc:doc>
1132- <doc:description>
1133- <doc:para>Emitted in response to a call to the <doc:ref type="method" to="Session.Lock">Lock()</doc:ref> method.</doc:para>
1134- <doc:para>It is intended that the screensaver for the session should lock the screen in response to this signal.</doc:para>
1135- </doc:description>
1136- </doc:doc>
1137- </signal>
1138- <signal name="Unlock">
1139- <doc:doc>
1140- <doc:description>
1141- <doc:para>Emitted in response to a call to the <doc:ref type="method" to="Session.Unlock">Unlock()</doc:ref> method.</doc:para>
1142- <doc:para>It is intended that the screensaver for the session should unlock the screen in response to this signal.</doc:para>
1143- </doc:description>
1144- </doc:doc>
1145- </signal>
1146-
1147- <property name="unix-user" type="u" access="readwrite">
1148- <doc:doc>
1149- <doc:description>
1150- <doc:para>The user assigned to the session.</doc:para>
1151- </doc:description>
1152- </doc:doc>
1153- </property>
1154- <property name="user" type="u" access="readwrite">
1155- <doc:doc>
1156- <doc:description>
1157- <doc:para>The user assigned to the session.</doc:para>
1158- </doc:description>
1159- <doc:deprecated version="0.1.3" instead="unix-user"/>
1160- </doc:doc>
1161- </property>
1162- <property name="session-type" type="s" access="readwrite">
1163- <doc:doc>
1164- <doc:description>
1165- <doc:para>The type of the session.</doc:para>
1166- <doc:para>Warning: we haven't yet defined the allowed values for this property.
1167- It is probably best to avoid this until we do.
1168- </doc:para>
1169- </doc:description>
1170- </doc:doc>
1171- </property>
1172- <property name="remote-host-name" type="s" access="readwrite">
1173- <doc:doc>
1174- <doc:description>
1175- <doc:para>The remote host name for the session.
1176- </doc:para>
1177- <doc:para>This will be set in situations where the session is
1178- opened and controlled from a remote system.
1179- </doc:para>
1180- <doc:para>For example, this value will be set when the
1181- session is created from an SSH or XDMCP connection.
1182- </doc:para>
1183- </doc:description>
1184- </doc:doc>
1185- </property>
1186- <property name="display-device" type="s" access="readwrite">
1187- <doc:doc>
1188- <doc:description>
1189- <doc:para>The display device (aka TTY) that the
1190- session is connected to.
1191- </doc:para>
1192- </doc:description>
1193- </doc:doc>
1194- </property>
1195- <property name="x11-display" type="s" access="readwrite">
1196- <doc:doc>
1197- <doc:description>
1198- <doc:para>Value of the X11 DISPLAY for this session
1199- if one is present.
1200- </doc:para>
1201- </doc:description>
1202- </doc:doc>
1203- </property>
1204- <property name="x11-display-device" type="s" access="readwrite">
1205- <doc:doc>
1206- <doc:description>
1207- <doc:para>
1208- The display device (aka TTY) that the X11 display for the
1209- session is connected to. If there is no x11-display set then
1210- this value is undefined.
1211- </doc:para>
1212- </doc:description>
1213- </doc:doc>
1214- </property>
1215- <property name="active" type="b" access="readwrite">
1216- <doc:doc>
1217- <doc:description>
1218- <doc:para>
1219- Whether the session is active on the Seat that
1220- it is attached to.</doc:para>
1221- <doc:para>If the session is not attached to a seat this value is undefined.
1222- </doc:para>
1223- </doc:description>
1224- </doc:doc>
1225- </property>
1226- <property name="is-local" type="b" access="readwrite">
1227- <doc:doc>
1228- <doc:description>
1229- <doc:para>
1230- Whether the session is local</doc:para>
1231- <doc:para>FIXME: we need to come up with a concrete definition for this value.
1232- It was originally used as a way to identify XDMCP sessions that originate
1233- from a remote system.
1234- </doc:para>
1235- </doc:description>
1236- </doc:doc>
1237- </property>
1238- <property name="idle-hint" type="b" access="readwrite">
1239- <doc:doc>
1240- <doc:description>
1241- <doc:para>
1242- This is a hint used to indicate that the session may be idle.
1243- </doc:para>
1244- <doc:para>
1245- For sessions with a <doc:ref type="property" to="Session:x11-display">x11-display</doc:ref> set (ie. graphical
1246- sessions), it is up to each session to delegate the
1247- responsibility for updating this value. Typically, the
1248- screensaver will set this.
1249- </doc:para>
1250- <doc:para>However, for non-graphical sessions with a <doc:ref type="property" to="Session:display-device">display-device</doc:ref> set
1251- the Session object itself will periodically update this value based
1252- on the activity detected on the display-device itself.
1253- </doc:para>
1254- <doc:para>
1255- This should not be considered authoritative.
1256- </doc:para>
1257- </doc:description>
1258- </doc:doc>
1259- </property>
1260-
1261- </interface>
1262-</node>
1263
1264=== added file 'src/org.freedesktop.login1.Manager.xml'
1265--- src/org.freedesktop.login1.Manager.xml 1970-01-01 00:00:00 +0000
1266+++ src/org.freedesktop.login1.Manager.xml 2013-04-22 12:49:38 +0000
1267@@ -0,0 +1,199 @@
1268+<?xml version="1.0"?>
1269+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
1270+<node>
1271+ <interface name="org.freedesktop.login1.Manager">
1272+ <method name="GetSession">
1273+ <arg name="id" type="s" direction="in"/>
1274+ <arg name="session" type="o" direction="out"/>
1275+ </method>
1276+ <method name="GetSessionByPID">
1277+ <arg name="pid" type="u" direction="in"/>
1278+ <arg name="session" type="o" direction="out"/>
1279+ </method>
1280+ <method name="GetUser">
1281+ <arg name="uid" type="u" direction="in"/>
1282+ <arg name="user" type="o" direction="out"/>
1283+ </method>
1284+ <method name="GetSeat">
1285+ <arg name="id" type="s" direction="in"/>
1286+ <arg name="seat" type="o" direction="out"/>
1287+ </method>
1288+ <method name="ListSessions">
1289+ <arg name="sessions" type="a(susso)" direction="out"/>
1290+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="SessionObjectList"/>
1291+ </method>
1292+ <method name="ListUsers">
1293+ <arg name="users" type="a(uso)" direction="out"/>
1294+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="UintStringPathList"/>
1295+ </method>
1296+ <method name="ListSeats">
1297+ <arg name="seats" type="a(so)" direction="out"/>
1298+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="StringPathList"/>
1299+ </method>
1300+ <method name="CreateSession">
1301+ <arg name="uid" type="u" direction="in"/>
1302+ <arg name="leader" type="u" direction="in"/>
1303+ <arg name="sevice" type="s" direction="in"/>
1304+ <arg name="type" type="s" direction="in"/>
1305+ <arg name="klass" type="s" direction="in"/>
1306+ <arg name="seat" type="s" direction="in"/>
1307+ <arg name="vtnr" type="u" direction="in"/>
1308+ <arg name="tty" type="s" direction="in"/>
1309+ <arg name="display" type="s" direction="in"/>
1310+ <arg name="remote" type="b" direction="in"/>
1311+ <arg name="remote_user" type="s" direction="in"/>
1312+ <arg name="remote_host" type="s" direction="in"/>
1313+ <arg name="controllers" type="as" direction="in"/>
1314+ <arg name="reset_controllers" type="as" direction="in"/>
1315+ <arg name="kill_processes" type="b" direction="in"/>
1316+ <arg name="id" type="s" direction="out"/>
1317+ <arg name="path" type="o" direction="out"/>
1318+ <arg name="runtime_path" type="o" direction="out"/>
1319+ <arg name="fd" type="h" direction="out"/>
1320+ <arg name="seat" type="s" direction="out"/>
1321+ <arg name="vtnr" type="u" direction="out"/>
1322+ <arg name="existing" type="b" direction="out"/>
1323+ </method>
1324+ <method name="ReleaseSession">
1325+ <arg name="id" type="s" direction="in"/>
1326+ </method>
1327+ <method name="ActivateSession">
1328+ <arg name="id" type="s" direction="in"/>
1329+ </method>
1330+ <method name="ActivateSessionOnSeat">
1331+ <arg name="id" type="s" direction="in"/>
1332+ <arg name="seat" type="s" direction="in"/>
1333+ </method>
1334+ <method name="LockSession">
1335+ <arg name="id" type="s" direction="in"/>
1336+ </method>
1337+ <method name="UnlockSession">
1338+ <arg name="id" type="s" direction="in"/>
1339+ </method>
1340+ <method name="LockSessions"/>
1341+ <method name="KillSession">
1342+ <arg name="id" type="s" direction="in"/>
1343+ <arg name="who" type="s" direction="in"/>
1344+ <arg name="signal" type="s" direction="in"/>
1345+ </method>
1346+ <method name="KillUser">
1347+ <arg name="uid" type="u" direction="in"/>
1348+ <arg name="signal" type="s" direction="in"/>
1349+ </method>
1350+ <method name="TerminateSession">
1351+ <arg name="id" type="s" direction="in"/>
1352+ </method>
1353+ <method name="TerminateUser">
1354+ <arg name="uid" type="u" direction="in"/>
1355+ </method>
1356+ <method name="TerminateSeat">
1357+ <arg name="id" type="s" direction="in"/>
1358+ </method>
1359+ <method name="SetUserLinger">
1360+ <arg name="uid" type="u" direction="in"/>
1361+ <arg name="b" type="b" direction="in"/>
1362+ <arg name="interactive" type="b" direction="in"/>
1363+ </method>
1364+ <method name="AttachDevice">
1365+ <arg name="seat" type="s" direction="in"/>
1366+ <arg name="sysfs" type="s" direction="in"/>
1367+ <arg name="interactive" type="b" direction="in"/>
1368+ </method>
1369+ <method name="FlushDevices">
1370+ <arg name="interactive" type="b" direction="in"/>
1371+ </method>
1372+ <method name="PowerOff">
1373+ <arg name="interactive" type="b" direction="in"/>
1374+ </method>
1375+ <method name="Reboot">
1376+ <arg name="interactive" type="b" direction="in"/>
1377+ </method>
1378+ <method name="Suspend">
1379+ <arg name="interactive" type="b" direction="in"/>
1380+ </method>
1381+ <method name="Hibernate">
1382+ <arg name="interactive" type="b" direction="in"/>
1383+ </method>
1384+ <method name="HybridSleep">
1385+ <arg name="interactive" type="b" direction="in"/>
1386+ </method>
1387+ <method name="CanPowerOff">
1388+ <arg name="result" type="s" direction="out"/>
1389+ </method>
1390+ <method name="CanReboot">
1391+ <arg name="result" type="s" direction="out"/>
1392+ </method>
1393+ <method name="CanSuspend">
1394+ <arg name="result" type="s" direction="out"/>
1395+ </method>
1396+ <method name="CanHibernate">
1397+ <arg name="result" type="s" direction="out"/>
1398+ </method>
1399+ <method name="CanHybridSleep">
1400+ <arg name="result" type="s" direction="out"/>
1401+ </method>
1402+ <method name="Inhibit">
1403+ <arg name="what" type="s" direction="in"/>
1404+ <arg name="who" type="s" direction="in"/>
1405+ <arg name="why" type="s" direction="in"/>
1406+ <arg name="mode" type="s" direction="in"/>
1407+ <arg name="fd" type="h" direction="out"/>
1408+ </method>
1409+ <method name="ListInhibitors">
1410+ <arg name="inhibitors" type="a(ssssuu)" direction="out"/>
1411+ <!-- TODO: Create an appropriate type -->
1412+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantList"/>
1413+ </method>
1414+ <signal name="SessionNew">
1415+ <arg name="id" type="s"/>
1416+ <arg name="path" type="o"/>
1417+ </signal>
1418+ <signal name="SessionRemoved">
1419+ <arg name="id" type="s"/>
1420+ <arg name="path" type="o"/>
1421+ </signal>
1422+ <signal name="UserNew">
1423+ <arg name="uid" type="u"/>
1424+ <arg name="path" type="o"/>
1425+ </signal>
1426+ <signal name="UserRemoved">
1427+ <arg name="uid" type="u"/>
1428+ <arg name="path" type="o"/>
1429+ </signal>
1430+ <signal name="SeatNew">
1431+ <arg name="id" type="s"/>
1432+ <arg name="path" type="o"/>
1433+ </signal>
1434+ <signal name="SeatRemoved">
1435+ <arg name="id" type="s"/>
1436+ <arg name="path" type="o"/>
1437+ </signal>
1438+ <signal name="PrepareForShutdown">
1439+ <arg name="active" type="b"/>
1440+ </signal>
1441+ <signal name="PrepareForSleep">
1442+ <arg name="active" type="b"/>
1443+ </signal>
1444+ <property name="ControlGroupHierarchy" type="s" access="read"/>
1445+ <property name="Controllers" type="as" access="read"/>
1446+ <property name="ResetControllers" type="as" access="read"/>
1447+ <property name="NAutoVTs" type="u" access="read"/>
1448+ <property name="KillOnlyUsers" type="as" access="read"/>
1449+ <property name="KillExcludeUsers" type="as" access="read"/>
1450+ <property name="KillUserProcesses" type="b" access="read"/>
1451+ <property name="IdleHint" type="b" access="read"/>
1452+ <property name="IdleSinceHint" type="t" access="read"/>
1453+ <property name="IdleSinceHintMonotonic" type="t" access="read"/>
1454+ <property name="BlockInhibited" type="s" access="read"/>
1455+ <property name="DelayInhibited" type="s" access="read"/>
1456+ <property name="InhibitDelayMaxUSec" type="t" access="read"/>
1457+ <property name="HandlePowerKey" type="s" access="read"/>
1458+ <property name="HandleSuspendKey" type="s" access="read"/>
1459+ <property name="HandleHibernateKey" type="s" access="read"/>
1460+ <property name="HandleLidSwitch" type="s" access="read"/>
1461+ <property name="IdleAction" type="s" access="read"/>
1462+ <property name="IdleActionUSec" type="t" access="read"/>
1463+ <property name="PreparingForShutdown" type="b" access="read"/>
1464+ <property name="PreparingForSleep" type="b" access="read"/>
1465+ </interface>
1466+</node>
1467
1468=== added file 'src/org.freedesktop.login1.Seat.xml'
1469--- src/org.freedesktop.login1.Seat.xml 1970-01-01 00:00:00 +0000
1470+++ src/org.freedesktop.login1.Seat.xml 2013-04-22 12:49:38 +0000
1471@@ -0,0 +1,21 @@
1472+<?xml version="1.0"?>
1473+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
1474+<node>
1475+ <interface name="org.freedesktop.login1.Seat">
1476+ <method name="Terminate"/>
1477+ <method name="ActivateSession">
1478+ <arg name="id" type="s"/>
1479+ </method>
1480+ <property name="Id" type="s" access="read"/>
1481+ <property name="ActiveSession" type="so" access="read"/>
1482+ <property name="CanMultiSession" type="b" access="read"/>
1483+ <property name="CanTTY" type="b" access="read"/>
1484+ <property name="CanGraphical" type="b" access="read"/>
1485+ <property name="Sessions" type="a(so)" access="read">
1486+ <annotation name="org.qtproject.QtDBus.QtTypeName" value="StringPathList"/>
1487+ </property>
1488+ <property name="IdleHint" type="b" access="read"/>
1489+ <property name="IdleSinceHint" type="t" access="read"/>
1490+ <property name="IdleSinceHintMonotonic" type="t" access="read"/>
1491+ </interface>
1492+</node>
1493
1494=== added file 'src/org.freedesktop.login1.Session.xml'
1495--- src/org.freedesktop.login1.Session.xml 1970-01-01 00:00:00 +0000
1496+++ src/org.freedesktop.login1.Session.xml 2013-04-22 12:49:38 +0000
1497@@ -0,0 +1,49 @@
1498+<?xml version="1.0"?>
1499+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
1500+<node>
1501+ <interface name="org.freedesktop.login1.Session">
1502+ <method name="Terminate"/>
1503+ <method name="Activate"/>
1504+ <method name="Lock"/>
1505+ <method name="Unlock"/>
1506+ <method name="SetIdleHint">
1507+ <arg name="b" direction="in" type="b"/>
1508+ </method>
1509+ <method name="Kill">
1510+ <arg name="who" direction="in" type="s"/>
1511+ <arg name="signal" direction="in" type="s"/>
1512+ </method>
1513+ <signal name="Lock"/>
1514+ <signal name="Unlock"/>
1515+ <property name="Id" type="s" access="read"/>
1516+ <property name="User" type="(uo)" access="read">
1517+ <annotation name="org.qtproject.QtDBus.QtTypeName" value="UintPath"/>
1518+ </property>
1519+ <property name="Name" type="s" access="read"/>
1520+ <property name="Timestamp" type="t" access="read"/>
1521+ <property name="TimestampMonotonic" type="t" access="read"/>
1522+ <property name="DefaultControlGroup" type="s" access="read"/>
1523+ <property name="VTNr" type="u" access="read"/>
1524+ <property name="Seat" type="(so)" access="read">
1525+ <annotation name="org.qtproject.QtDBus.QtTypeName" value="StringPath"/>
1526+ </property>
1527+ <property name="TTY" type="s" access="read"/>
1528+ <property name="Display" type="s" access="read"/>
1529+ <property name="Remote" type="b" access="read"/>
1530+ <property name="RemoteHost" type="s" access="read"/>
1531+ <property name="RemoteUser" type="s" access="read"/>
1532+ <property name="Service" type="s" access="read"/>
1533+ <property name="Leader" type="u" access="read"/>
1534+ <property name="Audit" type="u" access="read"/>
1535+ <property name="Type" type="s" access="read"/>
1536+ <property name="Class" type="s" access="read"/>
1537+ <property name="Active" type="b" access="read"/>
1538+ <property name="State" type="s" access="read"/>
1539+ <property name="Controllers" type="as" access="read"/>
1540+ <property name="ResetControllers" type="as" access="read"/>
1541+ <property name="KillProcesses" type="b" access="read"/>
1542+ <property name="IdleHint" type="b" access="read"/>
1543+ <property name="IdleSinceHint" type="t" access="read"/>
1544+ <property name="IdleSinceHintMonotonic" type="t" access="read"/>
1545+ </interface>
1546+</node>
1547
1548=== added file 'src/org.freedesktop.login1.User.xml'
1549--- src/org.freedesktop.login1.User.xml 1970-01-01 00:00:00 +0000
1550+++ src/org.freedesktop.login1.User.xml 2013-04-22 12:49:38 +0000
1551@@ -0,0 +1,56 @@
1552+<?xml version="1.0"?>
1553+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
1554+<node>
1555+ <interface name="org.freedesktop.login1.User">
1556+ <method name="Terminate"/>
1557+ <method name="Kill">
1558+ <arg name="signal" direction="in" type="s"/>
1559+ </method>
1560+ <property name="UID" type="u" access="read"/>
1561+ <property name="GID" type="u" access="read"/>
1562+ <property name="Name" type="s" access="read"/>
1563+ <property name="Timestamp" type="t" access="read"/>
1564+ <property name="TimestampMonotonic" type="t" access="read"/>
1565+ <property name="RuntimePath" type="s" access="read"/>
1566+ <property name="DefaultControlGroup" type="s" access="read"/>
1567+ <property name="Service" type="s" access="read"/>
1568+ <property name="Display" type="(so)" access="read"/>
1569+ <property name="State" type="s" access="read"/>
1570+ <property name="Sessions" type="a(so)" access="read"/>
1571+ <property name="IdleHint" type="b" access="read"/>
1572+ <property name="IdleSinceHint" type="t" access="read"/>
1573+ <property name="IdleSinceHintMonotonic" type="t" access="read"/>
1574+ </interface>
1575+ <interface name="org.freedesktop.DBus.Properties">
1576+ <method name="Get">
1577+ <arg name="interface" direction="in" type="s"/>
1578+ <arg name="property" direction="in" type="s"/>
1579+ <arg name="value" direction="out" type="v"/>
1580+ </method>
1581+ <method name="GetAll">
1582+ <arg name="interface" direction="in" type="s"/>
1583+ <arg name="properties" direction="out" type="a{sv}"/>
1584+ </method>
1585+ <method name="Set">
1586+ <arg name="interface" direction="in" type="s"/>
1587+ <arg name="property" direction="in" type="s"/>
1588+ <arg name="value" direction="in" type="v"/>
1589+ </method>
1590+ <signal name="PropertiesChanged">
1591+ <arg type="s" name="interface"/>
1592+ <arg type="a{sv}" name="changed_properties"/>
1593+ <arg type="as" name="invalidated_properties"/>
1594+ </signal>
1595+ </interface>
1596+<interface name="org.freedesktop.DBus.Peer">
1597+ <method name="Ping"/>
1598+ <method name="GetMachineId">
1599+ <arg type="s" name="machine_uuid" direction="out"/>
1600+ </method>
1601+</interface>
1602+ <interface name="org.freedesktop.DBus.Introspectable">
1603+ <method name="Introspect">
1604+ <arg name="data" type="s" direction="out"/>
1605+ </method>
1606+ </interface>
1607+</node>
1608
1609=== modified file 'src/session-menu-mgr.c'
1610--- src/session-menu-mgr.c 2013-03-06 15:29:26 +0000
1611+++ src/session-menu-mgr.c 2013-04-22 12:49:38 +0000
1612@@ -29,7 +29,7 @@
1613 #include <libdbusmenu-glib/client.h>
1614 #include <libdbusmenu-gtk/menuitem.h>
1615
1616-#include "dbus-upower.h"
1617+#include "dbus-login1-manager.h"
1618 #include "session-menu-mgr.h"
1619 #include "shared-names.h"
1620 #include "users-service-dbus.h"
1621@@ -37,8 +37,8 @@
1622
1623 #define DEBUG_SHOW_ALL FALSE
1624
1625-#define UPOWER_ADDRESS "org.freedesktop.UPower"
1626-#define UPOWER_PATH "/org/freedesktop/UPower"
1627+#define LOGIN1_MANAGER_ADDRESS "org.freedesktop.login1"
1628+#define LOGIN1_MANAGER_PATH "/org/freedesktop/login1"
1629
1630 #define CMD_HELP "yelp"
1631 #define CMD_INFO "gnome-control-center info"
1632@@ -77,7 +77,7 @@
1633 * This is a pretty straightforward class: it creates the menumodel
1634 * and listens for events that can affect the model's properties.
1635 *
1636- * Simple event sources, such as GSettings and a UPower DBus proxy,
1637+ * Simple event sources, such as GSettings and a logind DBus proxy,
1638 * are handled here. More involved event sources are delegated to the
1639 * UsersServiceDBus facade class.
1640 */
1641@@ -104,18 +104,16 @@
1642 GSettings * indicator_settings;
1643 GSettings * keybinding_settings;
1644
1645- /* cached settings taken from the upower proxy */
1646+ /* cached settings taken from the logind proxy */
1647 gboolean can_hibernate;
1648 gboolean can_suspend;
1649- gboolean allow_hibernate;
1650- gboolean allow_suspend;
1651
1652 gboolean shell_mode;
1653 gboolean greeter_mode;
1654
1655 guint shell_name_watcher;
1656 GCancellable * cancellable;
1657- DBusUPower * upower_proxy;
1658+ Login1Manager * login1_manager_proxy;
1659 SessionDbus * session_dbus;
1660 UsersServiceDbus * users_dbus_facade;
1661 OnlineAccountsMgr * online_accounts_mgr;
1662@@ -123,7 +121,7 @@
1663
1664 static SwitcherMode get_switcher_mode (SessionMenuMgr *);
1665
1666-static void init_upower_proxy (SessionMenuMgr *);
1667+static void init_login1_proxy (SessionMenuMgr *);
1668 static void init_shell_watcher (SessionMenuMgr *);
1669
1670 static void update_screensaver_shortcut (SessionMenuMgr *);
1671@@ -203,7 +201,7 @@
1672 g_signal_connect (mgr->users_dbus_facade, "guest-logged-in-changed",
1673 G_CALLBACK(on_guest_logged_in_changed), mgr);
1674
1675- init_upower_proxy (mgr);
1676+ init_login1_proxy (mgr);
1677 init_shell_watcher (mgr);
1678
1679 /* Online accounts menu item */
1680@@ -224,7 +222,7 @@
1681 g_clear_object (&mgr->indicator_settings);
1682 g_clear_object (&mgr->lockdown_settings);
1683 g_clear_object (&mgr->keybinding_settings);
1684- g_clear_object (&mgr->upower_proxy);
1685+ g_clear_object (&mgr->login1_manager_proxy);
1686 g_clear_object (&mgr->users_dbus_facade);
1687 g_clear_object (&mgr->top_mi);
1688 g_clear_object (&mgr->session_dbus);
1689@@ -248,97 +246,67 @@
1690 object_class->dispose = session_menu_mgr_dispose;
1691 }
1692
1693-/***
1694-**** UPower Proxy:
1695-****
1696-**** 1. While bootstrapping, we invoke the AllowSuspend and AllowHibernate
1697-**** methods to find out whether or not those features are allowed.
1698-**** 2. While bootstrapping, we get the CanSuspend and CanHibernate properties
1699-**** and also listen for property changes.
1700-**** 3. These four values are used to set suspend and hibernate's visibility.
1701-****
1702-***/
1703-
1704-static void
1705-on_upower_properties_changed (SessionMenuMgr * mgr)
1706+static gboolean
1707+can_perform_operation (gchar * permission)
1708 {
1709- gboolean need_refresh = FALSE;
1710-
1711- if (mgr->upower_proxy != NULL)
1712- {
1713- gboolean b;
1714-
1715- /* suspend */
1716- b = dbus_upower_get_can_suspend (mgr->upower_proxy);
1717- if (mgr->can_suspend != b)
1718- {
1719- mgr->can_suspend = b;
1720- need_refresh = TRUE;
1721- }
1722-
1723- /* hibernate */
1724- b = dbus_upower_get_can_hibernate (mgr->upower_proxy);
1725- if (mgr->can_hibernate != b)
1726- {
1727- mgr->can_hibernate = b;
1728- need_refresh = TRUE;
1729- }
1730- }
1731-
1732- if (need_refresh)
1733- {
1734- update_session_menuitems (mgr);
1735- }
1736+ return g_strcmp0 ("yes", permission) == 0;
1737 }
1738
1739 static void
1740-init_upower_proxy (SessionMenuMgr * mgr)
1741+init_login1_proxy (SessionMenuMgr * mgr)
1742 {
1743 /* default values */
1744 mgr->can_suspend = TRUE;
1745 mgr->can_hibernate = TRUE;
1746- mgr->allow_suspend = TRUE;
1747- mgr->allow_hibernate = TRUE;
1748+
1749+ gchar * can_suspend;
1750+ gchar * can_hibernate;
1751
1752 mgr->cancellable = g_cancellable_new ();
1753
1754 GError * error = NULL;
1755- mgr->upower_proxy = dbus_upower_proxy_new_for_bus_sync (
1756+ mgr->login1_manager_proxy = login1_manager_proxy_new_for_bus_sync (
1757 G_BUS_TYPE_SYSTEM,
1758 G_DBUS_PROXY_FLAGS_NONE,
1759- UPOWER_ADDRESS,
1760- UPOWER_PATH,
1761+ LOGIN1_MANAGER_ADDRESS,
1762+ LOGIN1_MANAGER_PATH,
1763 NULL,
1764 &error);
1765 if (error != NULL)
1766 {
1767- g_warning ("Error creating upower proxy: %s", error->message);
1768+ g_warning ("Error creating logind proxy: %s", error->message);
1769 g_clear_error (&error);
1770 }
1771 else
1772 {
1773- dbus_upower_call_suspend_allowed_sync (mgr->upower_proxy,
1774- &mgr->allow_suspend,
1775- NULL,
1776- &error);
1777- if (error != NULL)
1778- {
1779- g_warning ("%s: %s", G_STRFUNC, error->message);
1780- g_clear_error (&error);
1781- }
1782-
1783- dbus_upower_call_hibernate_allowed_sync (mgr->upower_proxy,
1784- &mgr->allow_hibernate,
1785- NULL,
1786- &error);
1787- if (error != NULL)
1788- {
1789- g_warning ("%s: %s", G_STRFUNC, error->message);
1790- g_clear_error (&error);
1791- }
1792-
1793- g_signal_connect_swapped (mgr->upower_proxy, "changed",
1794- G_CALLBACK(on_upower_properties_changed), mgr);
1795+ login1_manager_call_can_suspend_sync (mgr->login1_manager_proxy,
1796+ &can_suspend,
1797+ NULL,
1798+ &error);
1799+ if (error != NULL)
1800+ {
1801+ g_warning ("%s: %s", G_STRFUNC, error->message);
1802+ g_clear_error (&error);
1803+ }
1804+ else
1805+ {
1806+ mgr->can_suspend = can_perform_operation (can_suspend);
1807+ }
1808+
1809+ login1_manager_call_can_hibernate_sync (mgr->login1_manager_proxy,
1810+ &can_hibernate,
1811+ NULL,
1812+ &error);
1813+ if (error != NULL)
1814+ {
1815+ g_warning ("%s: %s", G_STRFUNC, error->message);
1816+ g_clear_error (&error);
1817+ }
1818+ else
1819+ {
1820+ mgr->can_hibernate = can_perform_operation (can_hibernate);
1821+ }
1822+
1823 }
1824 }
1825
1826@@ -505,13 +473,9 @@
1827 && !g_settings_get_boolean (s, "suppress-logout-menuitem");
1828 mi_set_visible (mgr->logout_mi, v);
1829
1830- v = mgr->can_suspend
1831- && mgr->allow_suspend;
1832- mi_set_visible (mgr->suspend_mi, v);
1833+ mi_set_visible (mgr->suspend_mi, mgr->can_suspend);
1834
1835- v = mgr->can_hibernate
1836- && mgr->allow_hibernate;
1837- mi_set_visible (mgr->hibernate_mi, v);
1838+ mi_set_visible (mgr->hibernate_mi, mgr->can_hibernate);
1839
1840 v = (!mgr->shell_mode || g_settings_get_boolean (s, "suppress-logout-restart-shutdown"))
1841 && (HAVE_RESTART_CMD || mgr->shell_mode)
1842@@ -878,10 +842,6 @@
1843 }
1844
1845 /* maybe the seat doesn't support activation */
1846- if (!users_service_dbus_can_activate_session (mgr->users_dbus_facade))
1847- {
1848- return FALSE;
1849- }
1850
1851 return TRUE;
1852 }
1853@@ -1147,9 +1107,10 @@
1854 {
1855 GError * error = NULL;
1856
1857- dbus_upower_call_suspend_sync (mgr->upower_proxy,
1858- mgr->cancellable,
1859- &error);
1860+ login1_manager_call_suspend_sync (mgr->login1_manager_proxy,
1861+ TRUE,
1862+ mgr->cancellable,
1863+ &error);
1864
1865 if (error != NULL)
1866 {
1867@@ -1163,9 +1124,10 @@
1868 {
1869 GError * error = NULL;
1870
1871- dbus_upower_call_hibernate_sync (mgr->upower_proxy,
1872- mgr->cancellable,
1873- &error);
1874+ login1_manager_call_hibernate_sync (mgr->login1_manager_proxy,
1875+ TRUE,
1876+ mgr->cancellable,
1877+ &error);
1878
1879 if (error != NULL)
1880 {
1881@@ -1350,10 +1312,6 @@
1882 update_user_menuitems (mgr);
1883 build_session_menuitems (mgr);
1884
1885- /* After we have the session menu items built we can look to
1886- align them with UPower */
1887- on_upower_properties_changed (mgr);
1888-
1889 return mgr;
1890 }
1891
1892
1893=== removed file 'src/upower.xml'
1894--- src/upower.xml 2012-06-12 05:39:31 +0000
1895+++ src/upower.xml 1970-01-01 00:00:00 +0000
1896@@ -1,309 +0,0 @@
1897-<!DOCTYPE node PUBLIC
1898-"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
1899-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
1900-<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
1901-
1902- <interface name="org.freedesktop.UPower">
1903- <doc:doc>
1904- <doc:description>
1905- <doc:para>
1906- The DeviceKit-power service is available via the system message
1907- bus. To access the service, use
1908- the <doc:tt>org.freedesktop.UPower</doc:tt> interface on
1909- the <doc:tt>/org/freedesktop/UPower</doc:tt> object on
1910- the D-Bus system bus service with the well-known
1911- name <doc:tt>org.freedesktop.UPower</doc:tt>.
1912- </doc:para>
1913- <doc:para>
1914- <doc:example language="shell" title="simple example">
1915- <doc:code>
1916-$ dbus-send --print-reply \
1917- --system \
1918- --dest=org.freedesktop.UPower \
1919- /org/freedesktop/UPower \
1920- org.freedesktop.UPower.EnumerateDevices
1921-
1922-method return sender=:1.386 -> dest=:1.451 reply_serial=2
1923- array [
1924- object path "/org/freedesktop/UPower/devices/line_power_AC"
1925- object path "/org/freedesktop/UPower/devices/battery_BAT0"
1926- ]
1927- </doc:code>
1928- </doc:example>
1929- </doc:para>
1930- </doc:description>
1931- </doc:doc>
1932-
1933- <!-- ************************************************************ -->
1934-
1935- <method name="EnumerateDevices">
1936- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
1937- <arg name="devices" direction="out" type="ao">
1938- <doc:doc><doc:summary>An array of object paths for devices.</doc:summary></doc:doc>
1939- </arg>
1940-
1941- <doc:doc>
1942- <doc:description>
1943- <doc:para>
1944- Enumerate all power objects on the system.
1945- </doc:para>
1946- </doc:description>
1947- </doc:doc>
1948- </method>
1949-
1950- <!-- ************************************************************ -->
1951-
1952- <signal name="DeviceAdded">
1953- <arg name="device" type="o">
1954- <doc:doc><doc:summary>Object path of device that was added.</doc:summary></doc:doc>
1955- </arg>
1956-
1957- <doc:doc>
1958- <doc:description>
1959- <doc:para>
1960- Emitted when a device is added.
1961- </doc:para>
1962- </doc:description>
1963- </doc:doc>
1964- </signal>
1965-
1966- <!-- ************************************************************ -->
1967-
1968- <signal name="DeviceRemoved">
1969- <arg name="device" type="o">
1970- <doc:doc><doc:summary>Object path of device that was removed.</doc:summary></doc:doc>
1971- </arg>
1972-
1973- <doc:doc>
1974- <doc:description>
1975- <doc:para>
1976- Emitted when a device is removed.
1977- </doc:para>
1978- </doc:description>
1979- </doc:doc>
1980- </signal>
1981-
1982- <!-- ************************************************************ -->
1983-
1984- <signal name="DeviceChanged">
1985- <arg name="device" type="s">
1986- <doc:doc><doc:summary>Object path of device that was changed.</doc:summary></doc:doc>
1987- </arg>
1988-
1989- <doc:doc>
1990- <doc:description>
1991- <doc:para>
1992- Emitted when a device changed.
1993- </doc:para>
1994- </doc:description>
1995- </doc:doc>
1996- </signal>
1997-
1998- <!-- ************************************************************ -->
1999-
2000- <signal name="Changed">
2001- <doc:doc>
2002- <doc:description>
2003- <doc:para>
2004- Emitted when one or more properties on the object changes.
2005- </doc:para>
2006- </doc:description>
2007- </doc:doc>
2008- </signal>
2009-
2010- <!-- ************************************************************ -->
2011-
2012- <signal name="Sleeping">
2013- <doc:doc>
2014- <doc:description>
2015- <doc:para>
2016- This signal is sent when the session is about to be suspended or
2017- hibernated.
2018- Session and system programs have one second to do anything required
2019- before the sleep action is taken (such as sending out Avahi or
2020- Jabber messages).
2021- </doc:para>
2022- </doc:description>
2023- </doc:doc>
2024- </signal>
2025-
2026- <!-- ************************************************************ -->
2027-
2028- <signal name="Resuming">
2029- <doc:doc>
2030- <doc:description>
2031- <doc:para>
2032- This signal is sent when the session has just returned from
2033- Suspend() or Hibernate().
2034- Session and system programs can then do anything required (such as
2035- sending out Avahi or Jabber messages).
2036- </doc:para>
2037- </doc:description>
2038- </doc:doc>
2039- </signal>
2040-
2041- <!-- ************************************************************ -->
2042-
2043- <method name="AboutToSleep">
2044- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
2045- <doc:doc>
2046- <doc:description>
2047- <doc:para>
2048- This method tells UPower that the Suspend() or Hibernate() method
2049- is about to be called.
2050- This allows UPower to emit the Suspending signal whilst
2051- session activities are happening that have to be done before the
2052- suspend process is started.
2053- </doc:para>
2054- <doc:para>
2055- This method would typically be called by the session power
2056- management daemon, before it locks the screen and waits for the
2057- screen to fade to black.
2058- The session power management component would then call Suspend() or
2059- Hibernate() when these syncronous tasks have completed.
2060- </doc:para>
2061- <doc:para>
2062- If this method is not called than nothing bad will happen and
2063- Suspend() or Hibernate() will block for the required second.
2064- </doc:para>
2065- </doc:description>
2066- </doc:doc>
2067- </method>
2068-
2069- <!-- ************************************************************ -->
2070-
2071- <method name="Suspend">
2072- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
2073- <doc:doc>
2074- <doc:description>
2075- <doc:para>
2076- Suspends the computer into a low power state.
2077- System state is not preserved if the power is lost.
2078- </doc:para>
2079- <doc:para>
2080- If AboutToRequestSleep() has not been called then UPower will send
2081- the Sleeping() signal and block for one second.
2082- </doc:para>
2083- <doc:para>
2084- If AboutToRequestSleep() has been called less than one second
2085- before this method is called then UPower will block for the
2086- remaining time to complete one second of delay.
2087- </doc:para>
2088- </doc:description>
2089- </doc:doc>
2090- </method>
2091-
2092- <!-- ************************************************************ -->
2093-
2094- <method name="SuspendAllowed">
2095- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
2096- <arg name="allowed" direction="out" type="b">
2097- <doc:doc><doc:summary>TRUE if allowed, otherwise FALSE</doc:summary></doc:doc>
2098- </arg>
2099- <doc:doc>
2100- <doc:description>
2101- <doc:para>
2102- Check if the caller has (or can get) the PolicyKit privilege to call
2103- <doc:ref type="method" to="Power.Suspend">Suspend</doc:ref>.
2104- </doc:para>
2105- </doc:description>
2106- </doc:doc>
2107- </method>
2108-
2109- <!-- ************************************************************ -->
2110-
2111- <method name="Hibernate">
2112- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
2113- <doc:doc>
2114- <doc:description>
2115- <doc:para>
2116- Hibernates the computer into a low power state.
2117- System state is preserved if the power is lost.
2118- </doc:para>
2119- <doc:para>
2120- If AboutToRequestSleep() has not been called then UPower will send
2121- the Sleeping() signal and block for one second.
2122- </doc:para>
2123- <doc:para>
2124- If AboutToRequestSleep() has been called less than one second
2125- before this method is called then UPower will block for the
2126- remaining time to complete one second of delay.
2127- </doc:para>
2128- </doc:description>
2129- </doc:doc>
2130- </method>
2131-
2132- <!-- ************************************************************ -->
2133-
2134- <method name="HibernateAllowed">
2135- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
2136- <arg name="allowed" direction="out" type="b">
2137- <doc:doc><doc:summary>TRUE if allowed, otherwise FALSE</doc:summary></doc:doc>
2138- </arg>
2139- <doc:doc>
2140- <doc:description>
2141- <doc:para>
2142- Check if the caller has (or can get) the PolicyKit privilege to call
2143- <doc:ref type="method" to="Power.Hibernate">Hibernate</doc:ref>.
2144- </doc:para>
2145- </doc:description>
2146- </doc:doc>
2147- </method>
2148-
2149- <!-- ************************************************************ -->
2150-
2151- <property name="DaemonVersion" type="s" access="read">
2152- <doc:doc><doc:description><doc:para>
2153- Version of the running daemon, e.g. <doc:tt>002</doc:tt>.
2154- </doc:para></doc:description></doc:doc>
2155- </property>
2156-
2157- <property name="CanSuspend" type="b" access="read">
2158- <doc:doc><doc:description><doc:para>
2159- Whether the system is able to suspend.
2160- </doc:para></doc:description></doc:doc>
2161- </property>
2162-
2163- <property name="CanHibernate" type="b" access="read">
2164- <doc:doc><doc:description><doc:para>
2165- Whether the system is able to hibernate.
2166- </doc:para></doc:description></doc:doc>
2167- </property>
2168-
2169- <property name="OnBattery" type="b" access="read">
2170- <doc:doc><doc:description><doc:para>
2171- Indicates whether the system is running on battery power.
2172- This property is provided for convenience.
2173- </doc:para></doc:description></doc:doc>
2174- </property>
2175-
2176- <property name="OnLowBattery" type="b" access="read">
2177- <doc:doc><doc:description><doc:para>
2178- Indicates whether the system is running on battery power and if the battery is critically low.
2179- This property is provided for convenience.
2180- </doc:para></doc:description></doc:doc>
2181- </property>
2182-
2183- <property name="LidIsClosed" type="b" access="read">
2184- <doc:doc>
2185- <doc:description>
2186- <doc:para>
2187- Indicates if the laptop lid is closed where the display cannot be seen.
2188- </doc:para>
2189- </doc:description>
2190- </doc:doc>
2191- </property>
2192-
2193- <property name="LidIsPresent" type="b" access="read">
2194- <doc:doc>
2195- <doc:description>
2196- <doc:para>
2197- If the system has a lid device.
2198- </doc:para>
2199- </doc:description>
2200- </doc:doc>
2201- </property>
2202-
2203- </interface>
2204-
2205-</node>
2206
2207=== modified file 'src/users-service-dbus.c'
2208--- src/users-service-dbus.c 2012-11-12 23:30:15 +0000
2209+++ src/users-service-dbus.c 2013-04-22 12:49:38 +0000
2210@@ -30,16 +30,15 @@
2211 #include <pwd.h> /* getpwuid() */
2212
2213 #include "dbus-accounts.h"
2214-#include "dbus-consolekit-manager.h"
2215-#include "dbus-consolekit-seat.h"
2216-#include "dbus-consolekit-session.h"
2217+#include "dbus-login1-manager.h"
2218+#include "dbus-login1-session.h"
2219+#include "dbus-login1-user.h"
2220 #include "dbus-display-manager.h"
2221 #include "dbus-user.h"
2222 #include "shared-names.h"
2223 #include "users-service-dbus.h"
2224
2225-#define CK_ADDR "org.freedesktop.ConsoleKit"
2226-#define CK_SESSION_IFACE "org.freedesktop.ConsoleKit.Session"
2227+#define LOGIND_ADDR "org.freedesktop.login1"
2228
2229 /**
2230 ***
2231@@ -57,17 +56,19 @@
2232 const gchar * user_object_path,
2233 UsersServiceDbus * service);
2234
2235-static void on_session_added (ConsoleKitSeat * seat,
2236- const gchar * ssid,
2237- UsersServiceDbus * service);
2238-
2239-static void on_session_removed (ConsoleKitSeat * seat,
2240- const gchar * ssid,
2241- UsersServiceDbus * service);
2242-
2243-static void on_session_list (ConsoleKitSeat * seat,
2244- GAsyncResult * result,
2245- UsersServiceDbus * service);
2246+static void on_session_added (Login1Manager * proxy,
2247+ const gchar * ssid,
2248+ const gchar * path,
2249+ UsersServiceDbus * service);
2250+
2251+static void on_session_removed (Login1Manager * proxy,
2252+ const gchar * ssid,
2253+ const gchar * path,
2254+ UsersServiceDbus * service);
2255+
2256+static void on_session_list (Login1Manager * proxy,
2257+ GAsyncResult * result,
2258+ UsersServiceDbus * service);
2259
2260 /***
2261 **** Priv Struct
2262@@ -85,8 +86,7 @@
2263 GHashTable * users;
2264
2265 GCancellable * cancellable;
2266- ConsoleKitSeat * seat_proxy;
2267- ConsoleKitManager * ck_manager_proxy;
2268+ Login1Manager * manager_proxy;
2269 Accounts * accounts_proxy;
2270 };
2271
2272@@ -112,8 +112,7 @@
2273 UsersServiceDbusPrivate * priv = USERS_SERVICE_DBUS(object)->priv;
2274
2275 g_clear_object (&priv->accounts_proxy);
2276- g_clear_object (&priv->seat_proxy);
2277- g_clear_object (&priv->ck_manager_proxy);
2278+ g_clear_object (&priv->manager_proxy);
2279
2280 if (priv->cancellable != NULL)
2281 {
2282@@ -211,14 +210,14 @@
2283 g_object_unref);
2284
2285 /**
2286- *** create the consolekit manager proxy...
2287+ *** create the logind manager proxy...
2288 **/
2289
2290- p->ck_manager_proxy = console_kit_manager_proxy_new_for_bus_sync (
2291+ p->manager_proxy = login1_manager_proxy_new_for_bus_sync (
2292 G_BUS_TYPE_SYSTEM,
2293 G_DBUS_PROXY_FLAGS_NONE,
2294- "org.freedesktop.ConsoleKit",
2295- "/org/freedesktop/ConsoleKit/Manager",
2296+ "org.freedesktop.login1",
2297+ "/org/freedesktop/login1",
2298 NULL,
2299 &error);
2300 if (error != NULL)
2301@@ -229,36 +228,13 @@
2302
2303 p->seat = get_seat (self);
2304
2305- /**
2306- *** create the consolekit seat proxy...
2307- **/
2308-
2309- if (p->seat != NULL)
2310- {
2311- ConsoleKitSeat * proxy = console_kit_seat_proxy_new_for_bus_sync (
2312- G_BUS_TYPE_SYSTEM,
2313- G_DBUS_PROXY_FLAGS_NONE,
2314- "org.freedesktop.ConsoleKit",
2315- p->seat,
2316- NULL,
2317- &error);
2318-
2319- if (error != NULL)
2320- {
2321- g_warning ("Failed to connect to the ConsoleKit seat: %s", error->message);
2322- g_clear_error (&error);
2323- }
2324- else
2325- {
2326- g_signal_connect (proxy, "session-added",
2327- G_CALLBACK (on_session_added), self);
2328- g_signal_connect (proxy, "session-removed",
2329- G_CALLBACK (on_session_removed), self);
2330- console_kit_seat_call_get_sessions (proxy, p->cancellable,
2331- (GAsyncReadyCallback)on_session_list, self);
2332- p->seat_proxy = proxy;
2333- }
2334- }
2335+ g_signal_connect (p->manager_proxy, "session-new",
2336+ G_CALLBACK (on_session_added), self);
2337+ g_signal_connect (p->manager_proxy, "session-removed",
2338+ G_CALLBACK (on_session_removed), self);
2339+
2340+ login1_manager_call_list_sessions (p->manager_proxy, p->cancellable,
2341+ (GAsyncReadyCallback) on_session_list, self);
2342
2343 /**
2344 *** create the accounts manager proxy...
2345@@ -311,75 +287,129 @@
2346 ****
2347 ***/
2348
2349-static ConsoleKitSession*
2350-create_consolekit_session_proxy (const char * ssid)
2351-{
2352- GError * error = NULL;
2353-
2354- ConsoleKitSession * p = console_kit_session_proxy_new_for_bus_sync (
2355- G_BUS_TYPE_SYSTEM,
2356- G_DBUS_PROXY_FLAGS_NONE,
2357- CK_ADDR,
2358- ssid,
2359- NULL,
2360- &error);
2361- if (error != NULL)
2362- {
2363- g_warning ("%s: %s", G_STRLOC, error->message);
2364- g_error_free (error);
2365- }
2366-
2367- return p;
2368-}
2369+static Login1User*
2370+create_login1_user_proxy (const char * path)
2371+{
2372+
2373+ GError * error = NULL;
2374+
2375+ Login1User * p = login1_user_proxy_new_for_bus_sync (
2376+ G_BUS_TYPE_SYSTEM,
2377+ G_DBUS_PROXY_FLAGS_NONE,
2378+ LOGIND_ADDR,
2379+ path,
2380+ NULL,
2381+ &error);
2382+ if (error != NULL)
2383+ {
2384+ g_warning ("%s: %s", G_STRLOC, error->message);
2385+ g_error_free (error);
2386+ }
2387+
2388+ return p;
2389+}
2390+
2391+static Login1User *
2392+create_login1_user_proxy_from_uid (UsersServiceDbus * self,
2393+ guint64 uid)
2394+{
2395+ Login1Manager * manager = self->priv->manager_proxy;
2396+ Login1User * user_proxy = NULL;
2397+ gchar * user_object_path = NULL;
2398+ GError * error = NULL;
2399+
2400+ login1_manager_call_get_user_sync (manager, uid, &user_object_path, NULL,
2401+ &error);
2402+
2403+ if (error != NULL)
2404+ {
2405+ g_warning ("%s: %s", G_STRLOC, error->message);
2406+ g_error_free (error);
2407+ }
2408+
2409+ if (user_object_path != NULL)
2410+ user_proxy = create_login1_user_proxy (user_object_path);
2411+
2412+ return user_proxy;
2413+
2414+}
2415+
2416+static Login1Session *
2417+create_login1_session_proxy (const char * path)
2418+{
2419+ GError * error = NULL;
2420+
2421+ Login1Session * p = login1_session_proxy_new_for_bus_sync (
2422+ G_BUS_TYPE_SYSTEM,
2423+ G_DBUS_PROXY_FLAGS_NONE,
2424+ LOGIND_ADDR,
2425+ path,
2426+ NULL,
2427+ &error);
2428+ if (error != NULL)
2429+ {
2430+ g_warning ("%s: %s", G_STRLOC, error->message);
2431+ g_error_free (error);
2432+ }
2433+
2434+ return p;
2435+}
2436+
2437
2438 static gchar *
2439-get_seat_from_session_proxy (ConsoleKitSession * session_proxy)
2440+get_seat_from_session_proxy (Login1Session * session_proxy)
2441 {
2442- gchar * seat = NULL;
2443+ gchar * seat;
2444+ GVariant * seatobj = login1_session_get_seat (session_proxy);
2445
2446- GError * error = NULL;
2447- console_kit_session_call_get_seat_id_sync (session_proxy,
2448- &seat,
2449- NULL,
2450- &error);
2451- if (error != NULL)
2452- {
2453- g_debug ("%s: %s", G_STRLOC, error->message);
2454- g_error_free (error);
2455- }
2456+ g_variant_get (seatobj, "(so)", &seat, NULL);
2457
2458 return seat;
2459 }
2460
2461+static const gchar *
2462+get_display_from_session_proxy (Login1Session * session_proxy)
2463+{
2464+ const gchar * display;
2465+ display = login1_session_get_display (session_proxy);
2466+ return display;
2467+}
2468+
2469 static gchar *
2470 get_seat (UsersServiceDbus *service)
2471 {
2472 gchar * seat = NULL;
2473- gchar * ssid = NULL;
2474+ gchar * path = NULL;
2475 GError * error = NULL;
2476 UsersServiceDbusPrivate * priv = service->priv;
2477-
2478- console_kit_manager_call_get_current_session_sync (priv->ck_manager_proxy,
2479- &ssid,
2480- NULL,
2481- &error);
2482+ Login1Session * session_proxy = NULL;
2483+ pid_t pid = getpid();
2484+
2485+ login1_manager_call_get_session_by_pid_sync (priv->manager_proxy,
2486+ pid,
2487+ &path,
2488+ NULL,
2489+ &error);
2490+
2491
2492 if (error != NULL)
2493 {
2494 g_debug ("%s: %s", G_STRLOC, error->message);
2495 g_error_free (error);
2496+ goto out;
2497 }
2498- else
2499+
2500+ session_proxy = create_login1_session_proxy (path);
2501+
2502+ if (!session_proxy)
2503 {
2504- ConsoleKitSession * session = create_consolekit_session_proxy (ssid);
2505-
2506- if (session != NULL)
2507- {
2508- seat = get_seat_from_session_proxy (session);
2509- g_object_unref (session);
2510- }
2511+ g_debug ("%s: Could't get session proxy object", G_STRLOC);
2512 }
2513
2514+ seat = get_seat_from_session_proxy (session_proxy);
2515+
2516+out:
2517+ g_object_unref (session_proxy);
2518 return seat;
2519 }
2520
2521@@ -434,9 +464,10 @@
2522 static void
2523 add_user_session (UsersServiceDbus * service,
2524 AccountsUser * user,
2525- const gchar * ssid)
2526+ const gchar * ssid,
2527+ const gchar * path)
2528 {
2529- ConsoleKitSession * session_proxy = create_consolekit_session_proxy (ssid);
2530+ Login1Session * session_proxy = create_login1_session_proxy (path);
2531 if (session_proxy != NULL)
2532 {
2533 UsersServiceDbusPrivate * priv = service->priv;
2534@@ -446,12 +477,8 @@
2535 if (seat && priv->seat && !g_strcmp0 (seat, priv->seat))
2536 {
2537 /* does this session have a display? */
2538- gchar * display = NULL;
2539- console_kit_session_call_get_x11_display_sync (session_proxy,
2540- &display,
2541- NULL, NULL);
2542- const gboolean has_display = display && *display;
2543- g_free (display);
2544+ const gchar * display = get_display_from_session_proxy (session_proxy);
2545+ const gboolean has_display = g_strcmp0 ("", display) != 0;
2546
2547 if (has_display)
2548 {
2549@@ -480,33 +507,30 @@
2550 const char * username = accounts_user_get_user_name (user);
2551 g_debug ("%s adding %s (%i)", G_STRLOC, username, (int)uid);
2552
2553- GError * error = NULL;
2554- gchar ** sessions = NULL;
2555- console_kit_manager_call_get_sessions_for_unix_user_sync (
2556- self->priv->ck_manager_proxy,
2557- uid,
2558- &sessions,
2559- NULL,
2560- &error);
2561-
2562- if (error != NULL)
2563+ GVariant * sessions = NULL;
2564+
2565+ Login1User * user_proxy = create_login1_user_proxy_from_uid (self, uid);
2566+
2567+ if (user_proxy != NULL)
2568 {
2569- g_debug ("%s: %s", G_STRLOC, error->message);
2570- g_error_free (error);
2571+ sessions = login1_user_get_sessions (user_proxy);
2572 }
2573- else if (sessions != NULL)
2574+
2575+ if (sessions != NULL)
2576 {
2577- int i;
2578+ GVariantIter iter;
2579+ g_variant_iter_init (&iter, sessions);
2580+ gchar * id;
2581+ gchar * object_path;
2582
2583- for (i=0; sessions[i]; i++)
2584+ while (g_variant_iter_loop (&iter, "(so)", &id, &object_path))
2585 {
2586- const char * const ssid = sessions[i];
2587- g_debug ("%s adding %s's session %s", G_STRLOC, username, ssid);
2588- add_user_session (self, user, ssid);
2589+ g_debug ("%s adding %s's session %s", G_STRLOC, username, id);
2590+ add_user_session (self, user, id, object_path);
2591 }
2592+ }
2593
2594- g_strfreev (sessions);
2595- }
2596+ g_object_unref (user_proxy);
2597 }
2598
2599 /* returns true if this property is one we use */
2600@@ -723,9 +747,10 @@
2601 ***/
2602
2603 static void
2604-on_session_removed (ConsoleKitSeat * seat_proxy,
2605- const gchar * ssid,
2606- UsersServiceDbus * service)
2607+on_session_removed (Login1Manager * proxy,
2608+ const gchar * ssid,
2609+ const gchar * path,
2610+ UsersServiceDbus * service)
2611 {
2612 g_return_if_fail (IS_USERS_SERVICE_DBUS (service));
2613
2614@@ -757,42 +782,25 @@
2615 }
2616
2617 static gchar*
2618-get_unix_username_from_ssid (UsersServiceDbus * self,
2619- const gchar * ssid)
2620+get_unix_username_from_path (UsersServiceDbus * self,
2621+ const gchar * path)
2622 {
2623- gchar * username = NULL;
2624
2625- ConsoleKitSession * session_proxy = create_consolekit_session_proxy (ssid);
2626+ Login1Session * session_proxy = create_login1_session_proxy (path);
2627 if (session_proxy != NULL)
2628 {
2629- guint uid = 0;
2630- GError * error = NULL;
2631- console_kit_session_call_get_unix_user_sync (session_proxy,
2632- &uid,
2633- NULL, &error);
2634- if (error != NULL)
2635- {
2636- g_warning ("%s: %s", G_STRLOC, error->message);
2637- g_clear_error (&error);
2638- }
2639- else
2640- {
2641- errno = 0;
2642- const struct passwd * pwent = getpwuid (uid);
2643- if (pwent == NULL)
2644- {
2645- g_warning ("Failed to lookup user id %d: %s", (int)uid, g_strerror(errno));
2646- }
2647- else
2648- {
2649- username = g_strdup (pwent->pw_name);
2650- }
2651- }
2652+ gchar * username = g_strdup (login1_session_get_name (session_proxy));
2653+
2654+ g_debug ("%s Getting username for %s: %s", G_STRLOC, path, username);
2655
2656 g_object_unref (session_proxy);
2657+
2658+ return username;
2659+ }
2660+ else
2661+ {
2662+ return NULL;
2663 }
2664-
2665- return username;
2666 }
2667
2668 static gboolean
2669@@ -810,13 +818,14 @@
2670 /* If the new session belongs to 'guest', update our guest_ssid.
2671 Otherwise, call add_user_session() to update our session tables */
2672 static void
2673-on_session_added (ConsoleKitSeat * seat_proxy G_GNUC_UNUSED,
2674- const gchar * ssid,
2675- UsersServiceDbus * service)
2676+on_session_added (Login1Manager * proxy G_GNUC_UNUSED,
2677+ const gchar * ssid,
2678+ const gchar * path,
2679+ UsersServiceDbus * service)
2680 {
2681 g_return_if_fail (IS_USERS_SERVICE_DBUS(service));
2682
2683- gchar * username = get_unix_username_from_ssid (service, ssid);
2684+ gchar * username = get_unix_username_from_path (service, path);
2685 g_debug ("%s %s() username %s has new session %s", G_STRLOC, G_STRFUNC, username, ssid);
2686
2687 if (is_guest_username (username))
2688@@ -834,45 +843,59 @@
2689
2690 if (user != NULL)
2691 {
2692- add_user_session (service, user, ssid);
2693+ add_user_session (service, user, ssid, path);
2694 emit_user_login_changed (service, user);
2695 }
2696 }
2697
2698- g_free (username);
2699 }
2700
2701 /* Receives a list of sessions and calls on_session_added() for each of them */
2702 static void
2703-on_session_list (ConsoleKitSeat * seat_proxy,
2704+on_session_list (Login1Manager * proxy,
2705 GAsyncResult * result,
2706 UsersServiceDbus * self)
2707 {
2708 GError * error = NULL;
2709- gchar ** sessions = NULL;
2710+ GVariant * sessions;
2711 g_debug ("%s bootstrapping the session list", G_STRLOC);
2712
2713- console_kit_seat_call_get_sessions_finish (seat_proxy,
2714- &sessions,
2715- result,
2716- &error);
2717+ login1_manager_call_list_sessions_finish (proxy,
2718+ &sessions,
2719+ result,
2720+ &error);
2721
2722 if (error != NULL)
2723 {
2724 g_debug ("%s: %s", G_STRLOC, error->message);
2725 g_error_free (error);
2726 }
2727- else if (sessions != NULL)
2728+ else
2729 {
2730- int i;
2731-
2732- for (i=0; sessions[i]; i++)
2733+ GVariantIter * iter;
2734+ gchar * seat;
2735+ gchar * path;
2736+
2737+ g_variant_get (sessions, "a(susso)", &iter);
2738+
2739+ while (g_variant_iter_loop (iter,
2740+ "(susso)",
2741+ NULL,
2742+ NULL,
2743+ NULL,
2744+ &seat,
2745+ &path))
2746 {
2747- g_debug ("%s adding initial session '%s'", G_STRLOC, sessions[i]);
2748- on_session_added (seat_proxy, sessions[i], self);
2749+ if (g_strcmp0 (seat, self->priv->seat) == 0)
2750+ {
2751+ g_debug ("%s adding initial session '%s'", G_STRLOC, path);
2752+ on_session_added (proxy, seat, path, self);
2753+ }
2754 }
2755
2756- g_strfreev (sessions);
2757+ g_variant_iter_free (iter);
2758+ g_variant_unref (sessions);
2759+
2760 }
2761
2762 g_debug ("%s done bootstrapping the session list", G_STRLOC);
2763@@ -1005,27 +1028,6 @@
2764 }
2765
2766 gboolean
2767-users_service_dbus_can_activate_session (UsersServiceDbus * self)
2768-{
2769- gboolean can_activate = FALSE;
2770-
2771- g_return_val_if_fail (IS_USERS_SERVICE_DBUS(self), can_activate);
2772-
2773- GError * error = NULL;
2774- console_kit_seat_call_can_activate_sessions_sync (self->priv->seat_proxy,
2775- &can_activate,
2776- NULL,
2777- &error);
2778- if (error != NULL)
2779- {
2780- g_warning ("%s: %s", G_STRLOC, error->message);
2781- g_error_free (error);
2782- }
2783-
2784- return can_activate;
2785-}
2786-
2787-gboolean
2788 users_service_dbus_is_guest_logged_in (UsersServiceDbus * self)
2789 {
2790 g_return_val_if_fail (IS_USERS_SERVICE_DBUS(self), FALSE);
2791
2792=== modified file 'src/users-service-dbus.h'
2793--- src/users-service-dbus.h 2012-06-13 19:41:31 +0000
2794+++ src/users-service-dbus.h 2013-04-22 12:49:38 +0000
2795@@ -52,8 +52,8 @@
2796 * 2. Track which users currently have X sessions.
2797 * This is used for the menuitems' USER_ITEM_PROP_LOGGED_IN property.
2798 *
2799- * We initially build this list by calling org.freedesktop.ConsoleKit.Seat's
2800- * GetDevices method. We also monitor the seat for SessionAdded and
2801+ * We initially build this list by calling org.freedesktop.login1's
2802+ * ListSessions method. We also monitor the seat for SessionNew and
2803 * SessionRemoved and update the list accordingly.
2804 *
2805 * 3. Provide an API for user switching and guest sessions.
2806@@ -87,7 +87,6 @@
2807
2808 void users_service_dbus_show_greeter (UsersServiceDbus * self);
2809 gboolean users_service_dbus_guest_session_enabled (UsersServiceDbus * self);
2810-gboolean users_service_dbus_can_activate_session (UsersServiceDbus * self);
2811 void users_service_dbus_activate_guest_session (UsersServiceDbus * self);
2812 void users_service_dbus_activate_user_session (UsersServiceDbus * self,
2813 AccountsUser * user);

Subscribers

People subscribed via source and target branches