|
|
@ -15,12 +15,14 @@ |
|
|
|
#include <stdlib.h> |
|
|
|
#include <stdlib.h> |
|
|
|
#include <gtk/gtk.h> |
|
|
|
#include <gtk/gtk.h> |
|
|
|
#include <webkit2/webkit-web-extension.h> |
|
|
|
#include <webkit2/webkit-web-extension.h> |
|
|
|
|
|
|
|
#define WEBKIT_DOM_USE_UNSTABLE_API |
|
|
|
|
|
|
|
#include <webkitdom/WebKitDOMDOMWindowUnstable.h> |
|
|
|
#include <JavaScriptCore/JavaScript.h> |
|
|
|
#include <JavaScriptCore/JavaScript.h> |
|
|
|
#include <glib/gi18n.h> |
|
|
|
#include <glib/gi18n.h> |
|
|
|
|
|
|
|
|
|
|
|
#include <lightdm.h> |
|
|
|
#include <lightdm.h> |
|
|
|
|
|
|
|
|
|
|
|
#include <../config.h> |
|
|
|
#include <config.h> |
|
|
|
|
|
|
|
|
|
|
|
G_MODULE_EXPORT void |
|
|
|
G_MODULE_EXPORT void |
|
|
|
webkit_web_extension_initialize(WebKitWebExtension *extension); |
|
|
|
webkit_web_extension_initialize(WebKitWebExtension *extension); |
|
|
@ -34,8 +36,7 @@ static JSValueRef |
|
|
|
get_user_name_cb(JSContextRef context, |
|
|
|
get_user_name_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -47,8 +48,7 @@ static JSValueRef |
|
|
|
get_user_real_name_cb(JSContextRef context, |
|
|
|
get_user_real_name_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -60,8 +60,7 @@ static JSValueRef |
|
|
|
get_user_display_name_cb(JSContextRef context, |
|
|
|
get_user_display_name_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -73,8 +72,7 @@ static JSValueRef |
|
|
|
get_user_image_cb(JSContextRef context, |
|
|
|
get_user_image_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -86,8 +84,7 @@ static JSValueRef |
|
|
|
get_user_language_cb(JSContextRef context, |
|
|
|
get_user_language_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
const gchar *language = lightdm_user_get_language(user); |
|
|
|
const gchar *language = lightdm_user_get_language(user); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
@ -103,8 +100,7 @@ static JSValueRef |
|
|
|
get_user_layout_cb(JSContextRef context, |
|
|
|
get_user_layout_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
const gchar *layout = lightdm_user_get_layout(user); |
|
|
|
const gchar *layout = lightdm_user_get_layout(user); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
@ -120,8 +116,7 @@ static JSValueRef |
|
|
|
get_user_session_cb(JSContextRef context, |
|
|
|
get_user_session_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
const gchar *session = lightdm_user_get_session(user); |
|
|
|
const gchar *session = lightdm_user_get_session(user); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
@ -137,8 +132,7 @@ static JSValueRef |
|
|
|
get_user_logged_in_cb(JSContextRef context, |
|
|
|
get_user_logged_in_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMUser *user = JSObjectGetPrivate(thisObject); |
|
|
|
return JSValueMakeBoolean(context, lightdm_user_get_logged_in(user)); |
|
|
|
return JSValueMakeBoolean(context, lightdm_user_get_logged_in(user)); |
|
|
|
} |
|
|
|
} |
|
|
@ -147,8 +141,7 @@ static JSValueRef |
|
|
|
get_language_code_cb(JSContextRef context, |
|
|
|
get_language_code_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMLanguage *language = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMLanguage *language = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -160,8 +153,7 @@ static JSValueRef |
|
|
|
get_language_name_cb(JSContextRef context, |
|
|
|
get_language_name_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMLanguage *language = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMLanguage *language = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -174,8 +166,7 @@ static JSValueRef |
|
|
|
get_language_territory_cb(JSContextRef context, |
|
|
|
get_language_territory_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMLanguage *language = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMLanguage *language = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -187,8 +178,7 @@ static JSValueRef |
|
|
|
get_layout_name_cb(JSContextRef context, |
|
|
|
get_layout_name_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMLayout *layout = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMLayout *layout = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -200,8 +190,7 @@ static JSValueRef |
|
|
|
get_layout_short_description_cb(JSContextRef context, |
|
|
|
get_layout_short_description_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMLayout *layout = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMLayout *layout = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -213,8 +202,7 @@ static JSValueRef |
|
|
|
get_layout_description_cb(JSContextRef context, |
|
|
|
get_layout_description_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMLayout *layout = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMLayout *layout = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -226,8 +214,7 @@ static JSValueRef |
|
|
|
get_session_key_cb(JSContextRef context, |
|
|
|
get_session_key_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMSession *session = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMSession *session = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -235,12 +222,12 @@ get_session_key_cb (JSContextRef context, |
|
|
|
return JSValueMakeString(context, string); |
|
|
|
return JSValueMakeString(context, string); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static JSValueRef |
|
|
|
static JSValueRef |
|
|
|
get_session_name_cb(JSContextRef context, |
|
|
|
get_session_name_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMSession *session = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMSession *session = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -252,8 +239,7 @@ static JSValueRef |
|
|
|
get_session_comment_cb(JSContextRef context, |
|
|
|
get_session_comment_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMSession *session = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMSession *session = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -265,8 +251,7 @@ static JSValueRef |
|
|
|
get_hostname_cb(JSContextRef context, |
|
|
|
get_hostname_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
|
string = JSStringCreateWithUTF8CString(lightdm_get_hostname()); |
|
|
|
string = JSStringCreateWithUTF8CString(lightdm_get_hostname()); |
|
|
@ -278,8 +263,7 @@ static JSValueRef |
|
|
|
get_num_users_cb(JSContextRef context, |
|
|
|
get_num_users_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
gint num_users; |
|
|
|
gint num_users; |
|
|
|
|
|
|
|
|
|
|
|
num_users = g_list_length(lightdm_user_list_get_users(lightdm_user_list_get_instance())); |
|
|
|
num_users = g_list_length(lightdm_user_list_get_users(lightdm_user_list_get_instance())); |
|
|
@ -290,8 +274,7 @@ static JSValueRef |
|
|
|
get_users_cb(JSContextRef context, |
|
|
|
get_users_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
JSObjectRef array; |
|
|
|
JSObjectRef array; |
|
|
|
const GList *users, *link; |
|
|
|
const GList *users, *link; |
|
|
|
guint i, n_users = 0; |
|
|
|
guint i, n_users = 0; |
|
|
@ -300,8 +283,7 @@ get_users_cb (JSContextRef context, |
|
|
|
users = lightdm_user_list_get_users(lightdm_user_list_get_instance()); |
|
|
|
users = lightdm_user_list_get_users(lightdm_user_list_get_instance()); |
|
|
|
n_users = g_list_length((GList *) users); |
|
|
|
n_users = g_list_length((GList *) users); |
|
|
|
args = g_malloc(sizeof(JSValueRef) * (n_users + 1)); |
|
|
|
args = g_malloc(sizeof(JSValueRef) * (n_users + 1)); |
|
|
|
for (i = 0, link = users; link; i++, link = link->next) |
|
|
|
for (i = 0, link = users; link; i++, link = link->next) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMUser *user = link->data; |
|
|
|
LightDMUser *user = link->data; |
|
|
|
g_object_ref(user); |
|
|
|
g_object_ref(user); |
|
|
|
args[i] = JSObjectMake(context, lightdm_user_class, user); |
|
|
|
args[i] = JSObjectMake(context, lightdm_user_class, user); |
|
|
@ -316,8 +298,7 @@ static JSValueRef |
|
|
|
get_languages_cb(JSContextRef context, |
|
|
|
get_languages_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
JSObjectRef array; |
|
|
|
JSObjectRef array; |
|
|
|
const GList *languages, *link; |
|
|
|
const GList *languages, *link; |
|
|
|
guint i, n_languages = 0; |
|
|
|
guint i, n_languages = 0; |
|
|
@ -326,8 +307,7 @@ get_languages_cb (JSContextRef context, |
|
|
|
languages = lightdm_get_languages(); |
|
|
|
languages = lightdm_get_languages(); |
|
|
|
n_languages = g_list_length((GList *) languages); |
|
|
|
n_languages = g_list_length((GList *) languages); |
|
|
|
args = g_malloc(sizeof(JSValueRef) * (n_languages + 1)); |
|
|
|
args = g_malloc(sizeof(JSValueRef) * (n_languages + 1)); |
|
|
|
for (i = 0, link = languages; link; i++, link = link->next) |
|
|
|
for (i = 0, link = languages; link; i++, link = link->next) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMLanguage *language = link->data; |
|
|
|
LightDMLanguage *language = link->data; |
|
|
|
g_object_ref(language); |
|
|
|
g_object_ref(language); |
|
|
|
args[i] = JSObjectMake(context, lightdm_language_class, language); |
|
|
|
args[i] = JSObjectMake(context, lightdm_language_class, language); |
|
|
@ -342,8 +322,7 @@ static JSValueRef |
|
|
|
get_default_language_cb(JSContextRef context, |
|
|
|
get_default_language_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
|
string = JSStringCreateWithUTF8CString(lightdm_language_get_name((LightDMLanguage *) lightdm_get_language())); |
|
|
|
string = JSStringCreateWithUTF8CString(lightdm_language_get_name((LightDMLanguage *) lightdm_get_language())); |
|
|
@ -355,8 +334,7 @@ static JSValueRef |
|
|
|
get_default_layout_cb(JSContextRef context, |
|
|
|
get_default_layout_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
|
string = JSStringCreateWithUTF8CString(lightdm_layout_get_name(lightdm_get_layout())); |
|
|
|
string = JSStringCreateWithUTF8CString(lightdm_layout_get_name(lightdm_get_layout())); |
|
|
@ -368,8 +346,7 @@ static JSValueRef |
|
|
|
get_layouts_cb(JSContextRef context, |
|
|
|
get_layouts_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
JSObjectRef array; |
|
|
|
JSObjectRef array; |
|
|
|
const GList *layouts, *link; |
|
|
|
const GList *layouts, *link; |
|
|
|
guint i, n_layouts = 0; |
|
|
|
guint i, n_layouts = 0; |
|
|
@ -378,8 +355,7 @@ get_layouts_cb (JSContextRef context, |
|
|
|
layouts = lightdm_get_layouts(); |
|
|
|
layouts = lightdm_get_layouts(); |
|
|
|
n_layouts = g_list_length((GList *) layouts); |
|
|
|
n_layouts = g_list_length((GList *) layouts); |
|
|
|
args = g_malloc(sizeof(JSValueRef) * (n_layouts + 1)); |
|
|
|
args = g_malloc(sizeof(JSValueRef) * (n_layouts + 1)); |
|
|
|
for (i = 0, link = layouts; link; i++, link = link->next) |
|
|
|
for (i = 0, link = layouts; link; i++, link = link->next) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMLayout *layout = link->data; |
|
|
|
LightDMLayout *layout = link->data; |
|
|
|
g_object_ref(layout); |
|
|
|
g_object_ref(layout); |
|
|
|
args[i] = JSObjectMake(context, lightdm_layout_class, layout); |
|
|
|
args[i] = JSObjectMake(context, lightdm_layout_class, layout); |
|
|
@ -394,8 +370,7 @@ static JSValueRef |
|
|
|
get_layout_cb(JSContextRef context, |
|
|
|
get_layout_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
|
string = JSStringCreateWithUTF8CString(lightdm_layout_get_name(lightdm_get_layout())); |
|
|
|
string = JSStringCreateWithUTF8CString(lightdm_layout_get_name(lightdm_get_layout())); |
|
|
@ -408,8 +383,7 @@ set_layout_cb (JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef value, |
|
|
|
JSValueRef value, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
JSStringRef layout_arg; |
|
|
|
JSStringRef layout_arg; |
|
|
|
char layout[1024]; |
|
|
|
char layout[1024]; |
|
|
|
|
|
|
|
|
|
|
@ -430,8 +404,7 @@ static JSValueRef |
|
|
|
get_sessions_cb(JSContextRef context, |
|
|
|
get_sessions_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
JSObjectRef array; |
|
|
|
JSObjectRef array; |
|
|
|
const GList *sessions, *link; |
|
|
|
const GList *sessions, *link; |
|
|
|
guint i, n_sessions = 0; |
|
|
|
guint i, n_sessions = 0; |
|
|
@ -440,8 +413,7 @@ get_sessions_cb (JSContextRef context, |
|
|
|
sessions = lightdm_get_sessions(); |
|
|
|
sessions = lightdm_get_sessions(); |
|
|
|
n_sessions = g_list_length((GList *) sessions); |
|
|
|
n_sessions = g_list_length((GList *) sessions); |
|
|
|
args = g_malloc(sizeof(JSValueRef) * (n_sessions + 1)); |
|
|
|
args = g_malloc(sizeof(JSValueRef) * (n_sessions + 1)); |
|
|
|
for (i = 0, link = sessions; link; i++, link = link->next) |
|
|
|
for (i = 0, link = sessions; link; i++, link = link->next) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMSession *session = link->data; |
|
|
|
LightDMSession *session = link->data; |
|
|
|
g_object_ref(session); |
|
|
|
g_object_ref(session); |
|
|
|
args[i] = JSObjectMake(context, lightdm_session_class, session); |
|
|
|
args[i] = JSObjectMake(context, lightdm_session_class, session); |
|
|
@ -456,8 +428,7 @@ static JSValueRef |
|
|
|
get_default_session_cb(JSContextRef context, |
|
|
|
get_default_session_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -470,8 +441,7 @@ static JSValueRef |
|
|
|
get_timed_login_user_cb(JSContextRef context, |
|
|
|
get_timed_login_user_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef string; |
|
|
|
JSStringRef string; |
|
|
|
|
|
|
|
|
|
|
@ -484,22 +454,21 @@ static JSValueRef |
|
|
|
get_timed_login_delay_cb(JSContextRef context, |
|
|
|
get_timed_login_delay_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
gint delay; |
|
|
|
gint delay; |
|
|
|
|
|
|
|
|
|
|
|
delay = lightdm_greeter_get_autologin_timeout_hint(greeter); |
|
|
|
delay = lightdm_greeter_get_autologin_timeout_hint(greeter); |
|
|
|
return JSValueMakeNumber(context, delay); |
|
|
|
return JSValueMakeNumber(context, delay); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static JSValueRef |
|
|
|
static JSValueRef |
|
|
|
cancel_timed_login_cb(JSContextRef context, |
|
|
|
cancel_timed_login_cb(JSContextRef context, |
|
|
|
JSObjectRef function, |
|
|
|
JSObjectRef function, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
size_t argumentCount, |
|
|
|
size_t argumentCount, |
|
|
|
const JSValueRef arguments[], |
|
|
|
const JSValueRef arguments[], |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
|
|
|
|
|
|
|
|
// FIXME: Throw exception
|
|
|
|
// FIXME: Throw exception
|
|
|
@ -516,8 +485,7 @@ start_authentication_cb (JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
size_t argumentCount, |
|
|
|
size_t argumentCount, |
|
|
|
const JSValueRef arguments[], |
|
|
|
const JSValueRef arguments[], |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef name_arg; |
|
|
|
JSStringRef name_arg; |
|
|
|
char name[1024]; |
|
|
|
char name[1024]; |
|
|
@ -540,8 +508,7 @@ provide_secret_cb (JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
size_t argumentCount, |
|
|
|
size_t argumentCount, |
|
|
|
const JSValueRef arguments[], |
|
|
|
const JSValueRef arguments[], |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef secret_arg; |
|
|
|
JSStringRef secret_arg; |
|
|
|
char secret[1024]; |
|
|
|
char secret[1024]; |
|
|
@ -565,8 +532,7 @@ cancel_authentication_cb (JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
size_t argumentCount, |
|
|
|
size_t argumentCount, |
|
|
|
const JSValueRef arguments[], |
|
|
|
const JSValueRef arguments[], |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
|
|
|
|
|
|
|
|
// FIXME: Throw exception
|
|
|
|
// FIXME: Throw exception
|
|
|
@ -581,8 +547,7 @@ static JSValueRef |
|
|
|
get_authentication_user_cb(JSContextRef context, |
|
|
|
get_authentication_user_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
return JSValueMakeString(context, JSStringCreateWithUTF8CString(lightdm_greeter_get_authentication_user(greeter))); |
|
|
|
return JSValueMakeString(context, JSStringCreateWithUTF8CString(lightdm_greeter_get_authentication_user(greeter))); |
|
|
|
} |
|
|
|
} |
|
|
@ -591,8 +556,7 @@ static JSValueRef |
|
|
|
get_is_authenticated_cb(JSContextRef context, |
|
|
|
get_is_authenticated_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
return JSValueMakeBoolean(context, lightdm_greeter_get_is_authenticated(greeter)); |
|
|
|
return JSValueMakeBoolean(context, lightdm_greeter_get_is_authenticated(greeter)); |
|
|
|
} |
|
|
|
} |
|
|
@ -601,8 +565,7 @@ static JSValueRef |
|
|
|
get_can_suspend_cb(JSContextRef context, |
|
|
|
get_can_suspend_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
return JSValueMakeBoolean(context, lightdm_get_can_suspend()); |
|
|
|
return JSValueMakeBoolean(context, lightdm_get_can_suspend()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -612,8 +575,7 @@ suspend_cb (JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
size_t argumentCount, |
|
|
|
size_t argumentCount, |
|
|
|
const JSValueRef arguments[], |
|
|
|
const JSValueRef arguments[], |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
// FIXME: Throw exception
|
|
|
|
// FIXME: Throw exception
|
|
|
|
if (argumentCount != 0) |
|
|
|
if (argumentCount != 0) |
|
|
|
return JSValueMakeNull(context); |
|
|
|
return JSValueMakeNull(context); |
|
|
@ -626,8 +588,7 @@ static JSValueRef |
|
|
|
get_can_hibernate_cb(JSContextRef context, |
|
|
|
get_can_hibernate_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
return JSValueMakeBoolean(context, lightdm_get_can_hibernate()); |
|
|
|
return JSValueMakeBoolean(context, lightdm_get_can_hibernate()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -637,8 +598,7 @@ hibernate_cb (JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
size_t argumentCount, |
|
|
|
size_t argumentCount, |
|
|
|
const JSValueRef arguments[], |
|
|
|
const JSValueRef arguments[], |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
// FIXME: Throw exception
|
|
|
|
// FIXME: Throw exception
|
|
|
|
if (argumentCount != 0) |
|
|
|
if (argumentCount != 0) |
|
|
|
return JSValueMakeNull(context); |
|
|
|
return JSValueMakeNull(context); |
|
|
@ -651,8 +611,7 @@ static JSValueRef |
|
|
|
get_can_restart_cb(JSContextRef context, |
|
|
|
get_can_restart_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
return JSValueMakeBoolean(context, lightdm_get_can_restart()); |
|
|
|
return JSValueMakeBoolean(context, lightdm_get_can_restart()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -662,8 +621,7 @@ restart_cb (JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
size_t argumentCount, |
|
|
|
size_t argumentCount, |
|
|
|
const JSValueRef arguments[], |
|
|
|
const JSValueRef arguments[], |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
// FIXME: Throw exception
|
|
|
|
// FIXME: Throw exception
|
|
|
|
if (argumentCount != 0) |
|
|
|
if (argumentCount != 0) |
|
|
|
return JSValueMakeNull(context); |
|
|
|
return JSValueMakeNull(context); |
|
|
@ -676,8 +634,7 @@ static JSValueRef |
|
|
|
get_can_shutdown_cb(JSContextRef context, |
|
|
|
get_can_shutdown_cb(JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSStringRef propertyName, |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
return JSValueMakeBoolean(context, lightdm_get_can_shutdown()); |
|
|
|
return JSValueMakeBoolean(context, lightdm_get_can_shutdown()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -687,8 +644,7 @@ shutdown_cb (JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
size_t argumentCount, |
|
|
|
size_t argumentCount, |
|
|
|
const JSValueRef arguments[], |
|
|
|
const JSValueRef arguments[], |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
// FIXME: Throw exception
|
|
|
|
// FIXME: Throw exception
|
|
|
|
if (argumentCount != 0) |
|
|
|
if (argumentCount != 0) |
|
|
|
return JSValueMakeNull(context); |
|
|
|
return JSValueMakeNull(context); |
|
|
@ -703,11 +659,10 @@ login_cb (JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
size_t argumentCount, |
|
|
|
size_t argumentCount, |
|
|
|
const JSValueRef arguments[], |
|
|
|
const JSValueRef arguments[], |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
JSStringRef arg; |
|
|
|
JSStringRef arg; |
|
|
|
char username[1024], *session = NULL, *language = NULL; |
|
|
|
char username[1024], *session = NULL; |
|
|
|
|
|
|
|
|
|
|
|
// FIXME: Throw exception
|
|
|
|
// FIXME: Throw exception
|
|
|
|
|
|
|
|
|
|
|
@ -715,26 +670,38 @@ login_cb (JSContextRef context, |
|
|
|
JSStringGetUTF8CString(arg, username, 1024); |
|
|
|
JSStringGetUTF8CString(arg, username, 1024); |
|
|
|
JSStringRelease(arg); |
|
|
|
JSStringRelease(arg); |
|
|
|
|
|
|
|
|
|
|
|
if (argumentCount > 1) |
|
|
|
if (argumentCount > 1) { |
|
|
|
{ |
|
|
|
|
|
|
|
arg = JSValueToStringCopy(context, arguments[1], NULL); |
|
|
|
arg = JSValueToStringCopy(context, arguments[1], NULL); |
|
|
|
session = g_malloc(sizeof(char) * 1024); |
|
|
|
session = g_malloc(sizeof(char) * 1024); |
|
|
|
JSStringGetUTF8CString(arg, session, 1024); |
|
|
|
JSStringGetUTF8CString(arg, session, 1024); |
|
|
|
JSStringRelease(arg); |
|
|
|
JSStringRelease(arg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (argumentCount > 2) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
arg = JSValueToStringCopy (context, arguments[1], NULL); |
|
|
|
|
|
|
|
language = g_malloc (sizeof (char) * 1024); |
|
|
|
|
|
|
|
JSStringGetUTF8CString (arg, language, 1024); |
|
|
|
|
|
|
|
JSStringRelease (arg); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lightdm_greeter_start_session_sync(greeter, session, NULL); |
|
|
|
lightdm_greeter_start_session_sync(greeter, session, NULL); |
|
|
|
|
|
|
|
|
|
|
|
g_free(session); |
|
|
|
g_free(session); |
|
|
|
g_free (language); |
|
|
|
|
|
|
|
|
|
|
|
return JSValueMakeNull(context); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static JSValueRef |
|
|
|
|
|
|
|
set_language_cb(JSContextRef context, |
|
|
|
|
|
|
|
JSObjectRef function, |
|
|
|
|
|
|
|
JSObjectRef thisObject, |
|
|
|
|
|
|
|
size_t argumentCount, |
|
|
|
|
|
|
|
const JSValueRef arguments[], |
|
|
|
|
|
|
|
JSValueRef *exception) { |
|
|
|
|
|
|
|
LightDMGreeter *greeter = JSObjectGetPrivate(thisObject); |
|
|
|
|
|
|
|
JSStringRef arg; |
|
|
|
|
|
|
|
char language[1024]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: Throw exception
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arg = JSValueToStringCopy(context, arguments[0], NULL); |
|
|
|
|
|
|
|
JSStringGetUTF8CString(arg, language, 1024); |
|
|
|
|
|
|
|
JSStringRelease(arg); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lightdm_greeter_set_language(greeter, language); |
|
|
|
|
|
|
|
|
|
|
|
return JSValueMakeNull(context); |
|
|
|
return JSValueMakeNull(context); |
|
|
|
} |
|
|
|
} |
|
|
@ -745,8 +712,7 @@ gettext_cb (JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
size_t argumentCount, |
|
|
|
size_t argumentCount, |
|
|
|
const JSValueRef arguments[], |
|
|
|
const JSValueRef arguments[], |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
JSStringRef string_arg, result; |
|
|
|
JSStringRef string_arg, result; |
|
|
|
char string[1024]; |
|
|
|
char string[1024]; |
|
|
|
|
|
|
|
|
|
|
@ -768,8 +734,7 @@ ngettext_cb (JSContextRef context, |
|
|
|
JSObjectRef thisObject, |
|
|
|
JSObjectRef thisObject, |
|
|
|
size_t argumentCount, |
|
|
|
size_t argumentCount, |
|
|
|
const JSValueRef arguments[], |
|
|
|
const JSValueRef arguments[], |
|
|
|
JSValueRef *exception) |
|
|
|
JSValueRef *exception) { |
|
|
|
{ |
|
|
|
|
|
|
|
JSStringRef string_arg, plural_string_arg, result; |
|
|
|
JSStringRef string_arg, plural_string_arg, result; |
|
|
|
char string[1024], plural_string[1024]; |
|
|
|
char string[1024], plural_string[1024]; |
|
|
|
unsigned int n; |
|
|
|
unsigned int n; |
|
|
@ -862,6 +827,7 @@ static const JSStaticFunction lightdm_greeter_functions[] = |
|
|
|
{"hibernate", hibernate_cb, kJSPropertyAttributeReadOnly}, |
|
|
|
{"hibernate", hibernate_cb, kJSPropertyAttributeReadOnly}, |
|
|
|
{"restart", restart_cb, kJSPropertyAttributeReadOnly}, |
|
|
|
{"restart", restart_cb, kJSPropertyAttributeReadOnly}, |
|
|
|
{"shutdown", shutdown_cb, kJSPropertyAttributeReadOnly}, |
|
|
|
{"shutdown", shutdown_cb, kJSPropertyAttributeReadOnly}, |
|
|
|
|
|
|
|
{"set_language", set_language_cb, kJSPropertyAttributeReadOnly}, |
|
|
|
{"login", login_cb, kJSPropertyAttributeReadOnly}, |
|
|
|
{"login", login_cb, kJSPropertyAttributeReadOnly}, |
|
|
|
{NULL, NULL, 0} |
|
|
|
{NULL, NULL, 0} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -932,8 +898,7 @@ static const JSClassDefinition gettext_definition = |
|
|
|
static void |
|
|
|
static void |
|
|
|
web_page_created_callback(WebKitWebExtension *extension, |
|
|
|
web_page_created_callback(WebKitWebExtension *extension, |
|
|
|
WebKitWebPage *web_page, |
|
|
|
WebKitWebPage *web_page, |
|
|
|
gpointer user_data) |
|
|
|
gpointer user_data) { |
|
|
|
{ |
|
|
|
|
|
|
|
/* guint64 page_id = webkit_web_page_get_id (web_page); */ |
|
|
|
/* guint64 page_id = webkit_web_page_get_id (web_page); */ |
|
|
|
|
|
|
|
|
|
|
|
g_print("Page %" G_GUINT64_FORMAT "created for %s\n", |
|
|
|
g_print("Page %" G_GUINT64_FORMAT "created for %s\n", |
|
|
@ -945,8 +910,7 @@ static void |
|
|
|
window_object_cleared_callback(WebKitScriptWorld *world, |
|
|
|
window_object_cleared_callback(WebKitScriptWorld *world, |
|
|
|
WebKitWebPage *web_page, |
|
|
|
WebKitWebPage *web_page, |
|
|
|
WebKitFrame *frame, |
|
|
|
WebKitFrame *frame, |
|
|
|
LightDMGreeter *greeter) |
|
|
|
LightDMGreeter *greeter) { |
|
|
|
{ |
|
|
|
|
|
|
|
JSObjectRef gettext_object, lightdm_greeter_object; |
|
|
|
JSObjectRef gettext_object, lightdm_greeter_object; |
|
|
|
JSGlobalContextRef jsContext; |
|
|
|
JSGlobalContextRef jsContext; |
|
|
|
JSObjectRef globalObject; |
|
|
|
JSObjectRef globalObject; |
|
|
@ -979,8 +943,7 @@ window_object_cleared_callback (WebKitScriptWorld *world, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
show_prompt_cb (LightDMGreeter *greeter, const gchar *text, LightDMPromptType type, WebKitWebExtension *extension) |
|
|
|
show_prompt_cb(LightDMGreeter *greeter, const gchar *text, LightDMPromptType type, WebKitWebExtension *extension) { |
|
|
|
{ |
|
|
|
|
|
|
|
WebKitWebPage *web_page; |
|
|
|
WebKitWebPage *web_page; |
|
|
|
WebKitFrame *web_frame; |
|
|
|
WebKitFrame *web_frame; |
|
|
|
JSGlobalContextRef jsContext; |
|
|
|
JSGlobalContextRef jsContext; |
|
|
@ -1006,8 +969,7 @@ show_prompt_cb (LightDMGreeter *greeter, const gchar *text, LightDMPromptType ty |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
show_message_cb (LightDMGreeter *greeter, const gchar *text, LightDMMessageType type, WebKitWebExtension *extension) |
|
|
|
show_message_cb(LightDMGreeter *greeter, const gchar *text, LightDMMessageType type, WebKitWebExtension *extension) { |
|
|
|
{ |
|
|
|
|
|
|
|
WebKitWebPage *web_page; |
|
|
|
WebKitWebPage *web_page; |
|
|
|
WebKitFrame *web_frame; |
|
|
|
WebKitFrame *web_frame; |
|
|
|
JSGlobalContextRef jsContext; |
|
|
|
JSGlobalContextRef jsContext; |
|
|
@ -1030,8 +992,7 @@ show_message_cb (LightDMGreeter *greeter, const gchar *text, LightDMMessageType |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
|
authentication_complete_cb (LightDMGreeter *greeter, WebKitWebExtension *extension) |
|
|
|
authentication_complete_cb(LightDMGreeter *greeter, WebKitWebExtension *extension) { |
|
|
|
{ |
|
|
|
|
|
|
|
WebKitWebPage *web_page; |
|
|
|
WebKitWebPage *web_page; |
|
|
|
WebKitFrame *web_frame; |
|
|
|
WebKitFrame *web_frame; |
|
|
|
JSGlobalContextRef jsContext; |
|
|
|
JSGlobalContextRef jsContext; |
|
|
@ -1050,9 +1011,30 @@ authentication_complete_cb (LightDMGreeter *greeter, WebKitWebExtension *extensi |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean |
|
|
|
|
|
|
|
fade_timer_cb(gpointer data) { |
|
|
|
|
|
|
|
gdouble opacity; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
opacity = gtk_widget_get_opacity(window); |
|
|
|
|
|
|
|
opacity -= 0.1; |
|
|
|
|
|
|
|
if (opacity <= 0) { |
|
|
|
|
|
|
|
gtk_main_quit(); |
|
|
|
|
|
|
|
return FALSE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
gtk_widget_set_opacity(window, opacity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return TRUE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
|
|
|
quit_cb(LightDMGreeter *greeter, const gchar *username) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fade out the greeter
|
|
|
|
|
|
|
|
g_timeout_add(40, (GSourceFunc) fade_timer_cb, NULL); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
G_MODULE_EXPORT void |
|
|
|
G_MODULE_EXPORT void |
|
|
|
webkit_web_extension_initialize (WebKitWebExtension *extension) |
|
|
|
webkit_web_extension_initialize(WebKitWebExtension *extension) { |
|
|
|
{ |
|
|
|
|
|
|
|
LightDMGreeter *greeter; |
|
|
|
LightDMGreeter *greeter; |
|
|
|
|
|
|
|
|
|
|
|
greeter = lightdm_greeter_new(); |
|
|
|
greeter = lightdm_greeter_new(); |
|
|
@ -1060,6 +1042,8 @@ webkit_web_extension_initialize (WebKitWebExtension *extension) |
|
|
|
g_signal_connect(G_OBJECT(greeter), "authentication-complete", G_CALLBACK(authentication_complete_cb), extension); |
|
|
|
g_signal_connect(G_OBJECT(greeter), "authentication-complete", G_CALLBACK(authentication_complete_cb), extension); |
|
|
|
g_signal_connect(G_OBJECT(greeter), "show-prompt", G_CALLBACK(show_prompt_cb), extension); |
|
|
|
g_signal_connect(G_OBJECT(greeter), "show-prompt", G_CALLBACK(show_prompt_cb), extension); |
|
|
|
g_signal_connect(G_OBJECT(greeter), "show-message", G_CALLBACK(show_message_cb), extension); |
|
|
|
g_signal_connect(G_OBJECT(greeter), "show-message", G_CALLBACK(show_message_cb), extension); |
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(greeter), "show-error", G_CALLBACK(show_message_cb), extension); |
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(greeter), "quit", G_CALLBACK(quit_cb), extension); |
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(extension, "page-created", G_CALLBACK(web_page_created_callback), NULL); |
|
|
|
g_signal_connect(extension, "page-created", G_CALLBACK(web_page_created_callback), NULL); |
|
|
|
|
|
|
|
|
|
|
|