Merge lp:~mterry/indicator-session/lightdm-updates into lp:indicator-session/0.1

Proposed by Michael Terry
Status: Merged
Merged at revision: 169
Proposed branch: lp:~mterry/indicator-session/lightdm-updates
Merge into: lp:indicator-session/0.1
Diff against target: 112 lines (+47/-9)
2 files modified
src/display-manager.xml (+6/-3)
src/users-service-dbus.c (+41/-6)
To merge this branch: bzr merge lp:~mterry/indicator-session/lightdm-updates
Reviewer Review Type Date Requested Status
Conor Curran (community) Approve
Review via email: mp+69686@code.launchpad.net

Description of the change

LightDM's exposed org.freedesktop.DisplayManager interface seems to have changed. Here's the updates needed to make switching work.

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

looks good, thanks Michael

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/display-manager.xml'
2--- src/display-manager.xml 2011-07-05 06:10:58 +0000
3+++ src/display-manager.xml 2011-07-28 16:43:23 +0000
4@@ -1,17 +1,20 @@
5 <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
6 <node>
7- <interface name="org.freedesktop.DisplayManager">
8+ <interface name="org.freedesktop.DisplayManager.Seat">
9
10 <!-- Show greeter to allow new login / switch users -->
11- <method name="ShowGreeter"/>
12+ <method name="SwitchToGreeter"/>
13
14 <!-- Switch to a user, starting a new display if required -->
15 <method name="SwitchToUser">
16 <arg name="username" direction="in" type="s"/>
17+ <arg name="session" direction="in" type="s"/>
18 </method>
19
20 <!-- Switch to the guest user -->
21- <method name="SwitchToGuest"/>
22+ <method name="SwitchToGuest">
23+ <arg name="session" direction="in" type="s"/>
24+ </method>
25
26 </interface>
27 </node>
28
29=== modified file 'src/users-service-dbus.c'
30--- src/users-service-dbus.c 2011-07-11 10:58:39 +0000
31+++ src/users-service-dbus.c 2011-07-28 16:43:23 +0000
32@@ -195,15 +195,50 @@
33 create_display_manager_proxy (UsersServiceDbus *self)
34 {
35 UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);
36+ DBusGProxy *dm_proxy = NULL;
37+ GError *error = NULL;
38+ const gchar *cookie = NULL;
39+ gchar *seat = NULL;
40+
41+ cookie = g_getenv ("XDG_SESSION_COOKIE");
42+ if (cookie == NULL || cookie[0] == 0)
43+ {
44+ g_warning ("Failed to get DisplayManager proxy: XDG_SESSION_COOKIE undefined.");
45+ return;
46+ }
47+
48+ dm_proxy = dbus_g_proxy_new_for_name (priv->system_bus,
49+ "org.freedesktop.DisplayManager",
50+ "/org/freedesktop/DisplayManager",
51+ "org.freedesktop.DisplayManager");
52+
53+ if (!dm_proxy)
54+ {
55+ g_warning ("Failed to get DisplayManager proxy.");
56+ return;
57+ }
58+
59+ /* Now request the proper seat */
60+ if (!dbus_g_proxy_call (dm_proxy, "GetSeatForCookie", &error,
61+ G_TYPE_STRING, cookie, G_TYPE_INVALID,
62+ DBUS_TYPE_G_OBJECT_PATH, &seat, G_TYPE_INVALID))
63+ {
64+ g_warning ("Failed to get DisplayManager seat proxy: %s", error->message);
65+ g_object_unref (dm_proxy);
66+ g_error_free (error);
67+ return;
68+ }
69+ g_object_unref (dm_proxy);
70
71 priv->display_manager_proxy = dbus_g_proxy_new_for_name (priv->system_bus,
72 "org.freedesktop.DisplayManager",
73- "/org/freedesktop/DisplayManager",
74- "org.freedesktop.DisplayManager");
75+ seat,
76+ "org.freedesktop.DisplayManager.Seat");
77+ g_free (seat);
78
79 if (!priv->display_manager_proxy)
80 {
81- g_warning ("Failed to get DisplayManager proxy.");
82+ g_warning ("Failed to get DisplayManager seat proxy.");
83 return;
84 }
85 }
86@@ -780,7 +815,7 @@
87 {
88 g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE);
89 UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);
90- return org_freedesktop_DisplayManager_show_greeter(priv->display_manager_proxy, NULL);
91+ return org_freedesktop_DisplayManager_Seat_switch_to_greeter(priv->display_manager_proxy, NULL);
92 }
93
94 /* Activates the guest account if it can. */
95@@ -789,7 +824,7 @@
96 {
97 g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE);
98 UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);
99- return org_freedesktop_DisplayManager_switch_to_guest(priv->display_manager_proxy, NULL);
100+ return org_freedesktop_DisplayManager_Seat_switch_to_guest(priv->display_manager_proxy, "", NULL);
101 }
102
103 /* Activates a specific user */
104@@ -799,7 +834,7 @@
105 {
106 g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE);
107 UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);
108- return org_freedesktop_DisplayManager_switch_to_user(priv->display_manager_proxy, user->user_name, NULL);
109+ return org_freedesktop_DisplayManager_Seat_switch_to_user(priv->display_manager_proxy, user->user_name, "", NULL);
110 }
111
112 gboolean

Subscribers

People subscribed via source and target branches