コード例 #1
0
JS_EXPORT_API
gchar* greeter_get_default_session ()
{
    gchar *key = NULL;

    extern LightDMGreeter *greeter;
    guint i;

    gchar* session_name = g_strdup(
        lightdm_greeter_get_default_session_hint(greeter));
    if (session_name != NULL) {
        if (sessions == NULL) {
            sessions = lightdm_get_sessions ();
        }

        for (i = 0; i < g_list_length (sessions); ++i) {
            LightDMSession *session = (LightDMSession *)g_list_nth_data(
                sessions, i);
            gchar *name = g_strdup (lightdm_session_get_name (session));

            if (g_strcmp0 (session_name, name) == 0) {
                key = g_strdup (lightdm_session_get_key (session));
                g_free (name);
                break;

            } else {
                g_free (name);
                continue;
            }
        }
    }
    g_free (session_name);

    return key;
}
コード例 #2
0
static JSValueRef
get_session_name_cb(JSContextRef context,
					JSObjectRef thisObject,
					JSStringRef propertyName,
					JSValueRef *exception) {
	return string_or_null(context, lightdm_session_get_name(SESSION));
}
コード例 #3
0
JS_EXPORT_API
gchar* greeter_get_session_name (const gchar *key)
{
    gchar *name = NULL;
    LightDMSession *session = NULL;

    session = find_session_by_key (key);
    if (session != NULL) {
        name = g_strdup (lightdm_session_get_name (session));

    } else {
        g_warning("[%s]: session is NULL\n", __func__);
    }

    return name;
}