Merge lp:~ted/indicator-session/actually-get-sessions into lp:indicator-session/0.1

Proposed by Ted Gould
Status: Merged
Merged at revision: 177
Proposed branch: lp:~ted/indicator-session/actually-get-sessions
Merge into: lp:indicator-session/0.1
Diff against target: 278 lines (+207/-7)
3 files modified
src/Makefile.am (+16/-7)
src/org.freedesktop.ConsoleKit.Seat.xml (+164/-0)
src/users-service-dbus.c (+27/-0)
To merge this branch: bzr merge lp:~ted/indicator-session/actually-get-sessions
Reviewer Review Type Date Requested Status
Conor Curran (community) Approve
Review via email: mp+71950@code.launchpad.net

Description of the change

Makes it so that when we create the seat proxy we check to see if there are any existing sessions. A good idea really!

To post a comment you must log in.
Revision history for this message
Conor Curran (cjcurran) :
review: Approve

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 2011-07-26 17:23:59 +0000
3+++ src/Makefile.am 2011-08-17 21:14:32 +0000
4@@ -25,19 +25,26 @@
5 libsession_la_LIBADD = $(APPLET_LIBS)
6 libsession_la_LDFLAGS = -module -avoid-version
7
8-consolekit-manager-client.h: $(srcdir)/consolekit-manager.xml
9+consolekit-manager-client.h: $(srcdir)/org.freedesktop.ConsoleKit.Manager.xml
10 dbus-binding-tool \
11 --prefix=_consolekit_manager_client \
12 --mode=glib-client \
13 --output=consolekit-manager-client.h \
14- $(srcdir)/consolekit-manager.xml
15-
16-consolekit-session-client.h: $(srcdir)/consolekit-session.xml
17+ $(srcdir)/org.freedesktop.ConsoleKit.Manager.xml
18+
19+consolekit-seat-client.h: $(srcdir)/org.freedesktop.ConsoleKit.Seat.xml
20+ dbus-binding-tool \
21+ --prefix=_consolekit_seat_client \
22+ --mode=glib-client \
23+ --output=consolekit-seat-client.h \
24+ $(srcdir)/org.freedesktop.ConsoleKit.Seat.xml
25+
26+consolekit-session-client.h: $(srcdir)/org.freedesktop.ConsoleKit.Session.xml
27 dbus-binding-tool \
28 --prefix=_consolekit_session_client \
29 --mode=glib-client \
30 --output=consolekit-session-client.h \
31- $(srcdir)/consolekit-session.xml
32+ $(srcdir)/org.freedesktop.ConsoleKit.Session.xml
33
34 display-manager-client.h: $(srcdir)/display-manager.xml
35 dbus-binding-tool \
36@@ -143,6 +150,7 @@
37
38 BUILT_SOURCES = \
39 consolekit-manager-client.h \
40+ consolekit-seat-client.h \
41 consolekit-session-client.h \
42 display-manager-client.h \
43 gen-session-dbus.xml.c \
44@@ -152,8 +160,9 @@
45 accounts-service-user-client.h
46
47 EXTRA_DIST = \
48- consolekit-manager.xml \
49- consolekit-session.xml \
50+ org.freedesktop.ConsoleKit.Manager.xml \
51+ org.freedesktop.ConsoleKit.Seat.xml \
52+ org.freedesktop.ConsoleKit.Session.xml \
53 display-manager.xml \
54 session-dbus.xml \
55 upower.xml \
56
57=== renamed file 'src/consolekit-manager.xml' => 'src/org.freedesktop.ConsoleKit.Manager.xml'
58=== added file 'src/org.freedesktop.ConsoleKit.Seat.xml'
59--- src/org.freedesktop.ConsoleKit.Seat.xml 1970-01-01 00:00:00 +0000
60+++ src/org.freedesktop.ConsoleKit.Seat.xml 2011-08-17 21:14:32 +0000
61@@ -0,0 +1,164 @@
62+<?xml version="1.0" encoding="UTF-8"?>
63+<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
64+
65+ <interface name="org.freedesktop.ConsoleKit.Seat">
66+ <doc:doc>
67+ <doc:description>
68+ <doc:para>A seat is a collection of sessions and a set of hardware (usually at
69+least a keyboard and mouse). Only one session may be active on a
70+seat at a time.</doc:para>
71+ </doc:description>
72+ </doc:doc>
73+
74+ <method name="GetId">
75+ <arg name="sid" direction="out" type="o">
76+ <doc:doc>
77+ <doc:summary>Seat ID</doc:summary>
78+ </doc:doc>
79+ </arg>
80+ <doc:doc>
81+ <doc:description>
82+ <doc:para>Returns the ID for Seat.</doc:para>
83+ </doc:description>
84+ </doc:doc>
85+ </method>
86+
87+ <method name="GetSessions">
88+ <arg name="sessions" direction="out" type="ao">
89+ <doc:doc>
90+ <doc:summary>an array of Session IDs</doc:summary>
91+ </doc:doc>
92+ </arg>
93+ <doc:doc>
94+ <doc:description>
95+ <doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref>
96+ that are currently attached to this seat.</doc:para>
97+ <doc:para>Each Session ID is an D-Bus object path for the object that implements the
98+ <doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para>
99+ </doc:description>
100+ </doc:doc>
101+ </method>
102+
103+ <method name="GetDevices">
104+ <arg name="devices" direction="out" type="a(ss)">
105+ <doc:doc>
106+ <doc:summary>an array of devices</doc:summary>
107+ </doc:doc>
108+ </arg>
109+ <doc:doc>
110+ <doc:description>
111+ <doc:para>This gets a list of all the devices
112+ that are currently associated with this seat.</doc:para>
113+ <doc:para>Each device is an D-Bus structure that represents
114+ the device type and the device id.
115+ </doc:para>
116+ </doc:description>
117+ </doc:doc>
118+ </method>
119+
120+ <method name="GetActiveSession">
121+ <arg name="ssid" direction="out" type="o">
122+ <doc:doc>
123+ <doc:summary>Session ID</doc:summary>
124+ </doc:doc>
125+ </arg>
126+ <doc:doc>
127+ <doc:description>
128+ <doc:para>Gets the Session ID that is currently active on this Seat.</doc:para>
129+ <doc:para>Returns NULL if there is no active session.</doc:para>
130+ </doc:description>
131+ </doc:doc>
132+ </method>
133+
134+ <method name="CanActivateSessions">
135+ <arg name="can_activate" direction="out" type="b">
136+ <doc:doc>
137+ <doc:summary>TRUE if seat supports session activation</doc:summary>
138+ </doc:doc>
139+ </arg>
140+ <doc:doc>
141+ <doc:description><doc:para>Used to determine whether the seat supports session activation.</doc:para>
142+ </doc:description>
143+ </doc:doc>
144+ </method>
145+
146+ <method name="ActivateSession">
147+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
148+ <arg name="ssid" direction="in" type="o">
149+ <doc:doc>
150+ <doc:summary>Session ID</doc:summary>
151+ </doc:doc>
152+ </arg>
153+ <doc:doc>
154+ <doc:description>
155+ <doc:para>Attempt to activate the specified session. In most
156+ cases, if successful, this will cause the session to
157+ become visible and take control of the hardware that is
158+ associated with this seat.</doc:para>
159+ </doc:description>
160+ <doc:seealso><doc:ref type="method" to="Session.Activate">Activate()</doc:ref></doc:seealso>
161+ </doc:doc>
162+ </method>
163+
164+ <signal name="ActiveSessionChanged">
165+ <arg name="ssid" type="o">
166+ <doc:doc>
167+ <doc:summary>Session ID</doc:summary>
168+ </doc:doc>
169+ </arg>
170+ <doc:doc>
171+ <doc:description>
172+ <doc:para>Emitted when the active session has changed.</doc:para>
173+ </doc:description>
174+ </doc:doc>
175+ </signal>
176+ <signal name="SessionAdded">
177+ <arg name="ssid" type="o">
178+ <doc:doc>
179+ <doc:summary>Session ID</doc:summary>
180+ </doc:doc>
181+ </arg>
182+ <doc:doc>
183+ <doc:description>
184+ <doc:para>Emitted when a session has been added to the seat.</doc:para>
185+ </doc:description>
186+ </doc:doc>
187+ </signal>
188+ <signal name="SessionRemoved">
189+ <arg name="ssid" type="o">
190+ <doc:doc>
191+ <doc:summary>Session ID</doc:summary>
192+ </doc:doc>
193+ </arg>
194+ <doc:doc>
195+ <doc:description>
196+ <doc:para>Emitted when a session has been removed from the seat.</doc:para>
197+ </doc:description>
198+ </doc:doc>
199+ </signal>
200+ <signal name="DeviceAdded">
201+ <arg name="device" type="(ss)">
202+ <doc:doc>
203+ <doc:summary>Device structure</doc:summary>
204+ </doc:doc>
205+ </arg>
206+ <doc:doc>
207+ <doc:description>
208+ <doc:para>Emitted when a device has been associated with the seat.</doc:para>
209+ </doc:description>
210+ </doc:doc>
211+ </signal>
212+ <signal name="DeviceRemoved">
213+ <arg name="device" type="(ss)">
214+ <doc:doc>
215+ <doc:summary>Device structure</doc:summary>
216+ </doc:doc>
217+ </arg>
218+ <doc:doc>
219+ <doc:description>
220+ <doc:para>Emitted when a device has been dissociated from the seat.</doc:para>
221+ </doc:description>
222+ </doc:doc>
223+ </signal>
224+ </interface>
225+</node>
226
227=== renamed file 'src/consolekit-session.xml' => 'src/org.freedesktop.ConsoleKit.Session.xml'
228=== modified file 'src/users-service-dbus.c'
229--- src/users-service-dbus.c 2011-07-28 16:41:59 +0000
230+++ src/users-service-dbus.c 2011-08-17 21:14:32 +0000
231@@ -36,6 +36,7 @@
232 #include "accounts-service-client.h"
233 #include "consolekit-manager-client.h"
234 #include "consolekit-session-client.h"
235+#include "consolekit-seat-client.h"
236
237 #define CK_ADDR "org.freedesktop.ConsoleKit"
238 #define CK_SESSION_IFACE "org.freedesktop.ConsoleKit.Session"
239@@ -315,6 +316,28 @@
240 }
241 }
242
243+/* Get the initial sessions when starting up */
244+static void
245+get_cksessions_cb (DBusGProxy *proxy, GPtrArray * sessions, GError * error, gpointer userdata)
246+{
247+ if (error != NULL) {
248+ g_warning("Unable to get initial sessions: %s", error->message);
249+ return;
250+ }
251+
252+ /* If there's no error we should at least get an
253+ array of zero entries */
254+ g_return_if_fail(sessions != NULL);
255+ g_debug("Got %d initial sessions", sessions->len);
256+
257+ int i;
258+ for (i = 0; i < sessions->len; i++) {
259+ seat_proxy_session_added(proxy, g_ptr_array_index(sessions, i), USERS_SERVICE_DBUS(userdata));
260+ }
261+
262+ return;
263+}
264+
265 static void
266 create_seat_proxy (UsersServiceDbus *self)
267 {
268@@ -363,6 +386,10 @@
269 G_CALLBACK (seat_proxy_session_removed),
270 self,
271 NULL);
272+
273+ org_freedesktop_ConsoleKit_Seat_get_sessions_async (priv->seat_proxy, get_cksessions_cb, self);
274+
275+ return;
276 }
277
278 static void

Subscribers

People subscribed via source and target branches