~ubuntu-branches/debian/stretch/lightdm/stretch

« back to all changes in this revision

Viewing changes to src/login1.c

  • Committer: Package Import Robot
  • Author(s): Yves-Alexis Perez
  • Date: 2014-04-22 23:33:26 UTC
  • mfrom: (1.1.23) (16.1.11 experimental)
  • Revision ID: package-import@ubuntu.com-20140422233326-gpd7rgap1v53zkuy
Tags: 1.10.0-2
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
    }
142
142
    g_object_unref (bus);
143
143
}
 
144
 
 
145
void
 
146
login1_activate_session (const gchar *session_path)
 
147
{
 
148
    GDBusConnection *bus;
 
149
    GError *error = NULL;
 
150
 
 
151
    g_return_if_fail (session_path != NULL);
 
152
 
 
153
    g_debug ("Activating login1 session %s", session_path);
 
154
 
 
155
    bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
 
156
    if (error)
 
157
        g_warning ("Failed to get system bus: %s", error->message);
 
158
    g_clear_error (&error);
 
159
    if (!bus)
 
160
        return;
 
161
 
 
162
    if (session_path)
 
163
    {
 
164
        GVariant *result;
 
165
 
 
166
        result = g_dbus_connection_call_sync (bus,
 
167
                                              "org.freedesktop.login1",
 
168
                                              session_path,
 
169
                                              "org.freedesktop.login1.Session",
 
170
                                              "Activate",
 
171
                                              g_variant_new ("()"),
 
172
                                              G_VARIANT_TYPE ("()"),
 
173
                                              G_DBUS_CALL_FLAGS_NONE,
 
174
                                              -1,
 
175
                                              NULL,
 
176
                                              &error);
 
177
        if (error)
 
178
            g_warning ("Error activating login1 session: %s", error->message);
 
179
        g_clear_error (&error);
 
180
        if (result)
 
181
            g_variant_unref (result);
 
182
    }
 
183
    g_object_unref (bus);
 
184
}