diff options
author | Michael Terry <michael.terry@canonical.com> | 2011-08-02 12:18:19 -0400 |
---|---|---|
committer | Michael Terry <michael.terry@canonical.com> | 2011-08-02 12:18:19 -0400 |
commit | b587cf67da20cce1a8467c190696cbdb35ef347b (patch) | |
tree | a2b713518aa9a7e3ab23eab9867216e5202f9ce6 /src | |
parent | a1a7357b58d182e077ebfe8fb11c083e5eb18839 (diff) | |
parent | ab746cb4fde79721ddf85761a6496555206fd89b (diff) | |
download | ayatana-indicator-session-b587cf67da20cce1a8467c190696cbdb35ef347b.tar.gz ayatana-indicator-session-b587cf67da20cce1a8467c190696cbdb35ef347b.tar.bz2 ayatana-indicator-session-b587cf67da20cce1a8467c190696cbdb35ef347b.zip |
update to use LightDM's new interface
Diffstat (limited to 'src')
-rw-r--r-- | src/display-manager.xml | 9 | ||||
-rw-r--r-- | src/users-service-dbus.c | 47 |
2 files changed, 47 insertions, 9 deletions
diff --git a/src/display-manager.xml b/src/display-manager.xml index 004eca1..92f5e05 100644 --- a/src/display-manager.xml +++ b/src/display-manager.xml @@ -1,17 +1,20 @@ <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> <node> - <interface name="org.freedesktop.DisplayManager"> + <interface name="org.freedesktop.DisplayManager.Seat"> <!-- Show greeter to allow new login / switch users --> - <method name="ShowGreeter"/> + <method name="SwitchToGreeter"/> <!-- Switch to a user, starting a new display if required --> <method name="SwitchToUser"> <arg name="username" direction="in" type="s"/> + <arg name="session" direction="in" type="s"/> </method> <!-- Switch to the guest user --> - <method name="SwitchToGuest"/> + <method name="SwitchToGuest"> + <arg name="session" direction="in" type="s"/> + </method> </interface> </node> diff --git a/src/users-service-dbus.c b/src/users-service-dbus.c index 087378c..83edaa3 100644 --- a/src/users-service-dbus.c +++ b/src/users-service-dbus.c @@ -195,15 +195,50 @@ static void create_display_manager_proxy (UsersServiceDbus *self) { UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); + DBusGProxy *dm_proxy = NULL; + GError *error = NULL; + const gchar *cookie = NULL; + gchar *seat = NULL; + + cookie = g_getenv ("XDG_SESSION_COOKIE"); + if (cookie == NULL || cookie[0] == 0) + { + g_warning ("Failed to get DisplayManager proxy: XDG_SESSION_COOKIE undefined."); + return; + } + + dm_proxy = dbus_g_proxy_new_for_name (priv->system_bus, + "org.freedesktop.DisplayManager", + "/org/freedesktop/DisplayManager", + "org.freedesktop.DisplayManager"); + + if (!dm_proxy) + { + g_warning ("Failed to get DisplayManager proxy."); + return; + } + + /* Now request the proper seat */ + if (!dbus_g_proxy_call (dm_proxy, "GetSeatForCookie", &error, + G_TYPE_STRING, cookie, G_TYPE_INVALID, + DBUS_TYPE_G_OBJECT_PATH, &seat, G_TYPE_INVALID)) + { + g_warning ("Failed to get DisplayManager seat proxy: %s", error->message); + g_object_unref (dm_proxy); + g_error_free (error); + return; + } + g_object_unref (dm_proxy); priv->display_manager_proxy = dbus_g_proxy_new_for_name (priv->system_bus, "org.freedesktop.DisplayManager", - "/org/freedesktop/DisplayManager", - "org.freedesktop.DisplayManager"); + seat, + "org.freedesktop.DisplayManager.Seat"); + g_free (seat); if (!priv->display_manager_proxy) { - g_warning ("Failed to get DisplayManager proxy."); + g_warning ("Failed to get DisplayManager seat proxy."); return; } } @@ -780,7 +815,7 @@ users_service_dbus_show_greeter (UsersServiceDbus *self) { g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE); UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); - return org_freedesktop_DisplayManager_show_greeter(priv->display_manager_proxy, NULL); + return org_freedesktop_DisplayManager_Seat_switch_to_greeter(priv->display_manager_proxy, NULL); } /* Activates the guest account if it can. */ @@ -789,7 +824,7 @@ users_service_dbus_activate_guest_session (UsersServiceDbus *self) { g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE); UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); - return org_freedesktop_DisplayManager_switch_to_guest(priv->display_manager_proxy, NULL); + return org_freedesktop_DisplayManager_Seat_switch_to_guest(priv->display_manager_proxy, "", NULL); } /* Activates a specific user */ @@ -799,7 +834,7 @@ users_service_dbus_activate_user_session (UsersServiceDbus *self, { g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE); UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); - return org_freedesktop_DisplayManager_switch_to_user(priv->display_manager_proxy, user->user_name, NULL); + return org_freedesktop_DisplayManager_Seat_switch_to_user(priv->display_manager_proxy, user->user_name, "", NULL); } gboolean |