elementaryart team mailing list archive
-
elementaryart team
-
Mailing list archive
-
Message #01658
[Merge] lp:~elementaryart/lightdm-webkit-greeter/fixes into lp:lightdm-webkit-greeter
Fabian Thoma has proposed merging lp:~elementaryart/lightdm-webkit-greeter/fixes into lp:lightdm-webkit-greeter.
Requested reviews:
LightDM Development Team (lightdm-team)
Related bugs:
Bug #825878 in LightDM Webkit Greeter: "Webkit Greeter is not in Ubuntu Oneiric repos"
https://bugs.launchpad.net/lightdm-webkit-greeter/+bug/825878
For more details, see:
https://code.launchpad.net/~elementaryart/lightdm-webkit-greeter/fixes/+merge/75400
Fixed the greeter to work with the latest lightdm in Oneiric
--
https://code.launchpad.net/~elementaryart/lightdm-webkit-greeter/fixes/+merge/75400
Your team elementary desktop team is subscribed to branch lp:~elementaryart/lightdm-webkit-greeter/fixes.
=== modified file 'Makefile.am'
--- Makefile.am 2011-02-12 00:33:07 +0000
+++ Makefile.am 2011-09-14 18:40:52 +0000
@@ -18,3 +18,6 @@
omf.make \
xmldocs.make \
po/Makefile.in.in
+
+etcdir = /etc/lightdm/
+etc_DATA = lightdm-webkit-greeter.conf
=== modified file 'configure.ac'
--- configure.ac 2011-05-20 05:03:42 +0000
+++ configure.ac 2011-09-14 18:40:52 +0000
@@ -2,6 +2,7 @@
AC_INIT(lightdm-webkit-greeter, 0.1.0)
AC_CONFIG_MACRO_DIR(m4)
+AC_SUBST(THEME_DIR)
AC_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE
AM_PROG_CC_C_O
@@ -15,7 +16,7 @@
dnl ###########################################################################
PKG_CHECK_MODULES(GREETER, [
- liblightdm-gobject-0
+ liblightdm-gobject-1
gtk+-2.0
webkit-1.0
dbus-glib-1
@@ -24,11 +25,27 @@
dnl ###########################################################################
dnl Configurable values
dnl ###########################################################################
-THEME_DIR=`$PKG_CONFIG --define-variable=prefix=$prefix --variable=themedir liblightdm-gobject-0`
+THEME_DIR="/usr/share/lightdm-webkit/themes/"
+AC_ARG_WITH(theme-dir,
+ AS_HELP_STRING(--with-theme-dir=<path>,
+ Theme directory to use for webkit themes),
+ if test x$withval != x; then
+ THEME_DIR="$withval"
+ fi
+)
AC_SUBST(THEME_DIR)
+AC_DEFINE_UNQUOTED(THEME_DIR, "$THEME_DIR", Theme Dir)
-GREETER_DIR=`$PKG_CONFIG --define-variable=prefix=$prefix --variable=greeterdir liblightdm-gobject-0`
-AC_SUBST(GREETER_DIR)
+CONFIG_DIR="/etc/lightdm/"
+AC_ARG_WITH(config-dir,
+ AS_HELP_STRING(--with-config-dir=<path>,
+ Configuration directory of lightdm),
+ if test x$withval != x; then
+ CONFIG_DIR="$withval"
+ fi
+)
+AC_SUBST(CONFIG_DIR)
+AC_DEFINE_UNQUOTED(CONFIG_DIR, "$CONFIG_DIR", Config Dir)
dnl ###########################################################################
dnl Internationalization
@@ -60,5 +77,5 @@
prefix: $prefix
Theme directory: $THEME_DIR
- Greeter directory: $GREETER_DIR
+ Configuration directory: $CONFIG_DIR
"
=== added file 'lightdm-webkit-greeter.conf'
--- lightdm-webkit-greeter.conf 1970-01-01 00:00:00 +0000
+++ lightdm-webkit-greeter.conf 2011-09-14 18:40:52 +0000
@@ -0,0 +1,18 @@
+#
+# background = Background file to use, either an image path or a color (e.g. #772953)
+# theme-name = GTK+ theme to use
+# font-name = Font to use
+# xft-antialias = Whether to antialias Xft fonts (true or false)
+# xft-dpi = Resolution for Xft in dots per inch (e.g. 96)
+# xft-hintstyle = What degree of hinting to use (hintnone, hintslight, hintmedium, or hintfull)
+# xft-rgba = Type of subpixel antialiasing (none, rgb, bgr, vrgb or vbgr)
+#
+[greeter]
+background=/usr/share/backgrounds/warty-final-ubuntu.png
+theme-name=Ambiance
+webkit-theme=webkit
+font-name=Ubuntu 11
+xft-antialias=true
+xft-dpi=96
+xft-hintstyle=slight
+xft-rgba=rgb
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2011-05-20 05:03:42 +0000
+++ src/Makefile.am 2011-09-14 18:40:52 +0000
@@ -1,5 +1,5 @@
greeter_PROGRAMS = lightdm-webkit-greeter
-greeterdir = $(GREETER_DIR)
+greeterdir = $(bindir)
lightdm_webkit_greeter_SOURCES = \
lightdm-webkit-greeter.c
=== modified file 'src/lightdm-webkit-greeter.c'
--- src/lightdm-webkit-greeter.c 2011-05-20 05:28:00 +0000
+++ src/lightdm-webkit-greeter.c 2011-09-14 18:40:52 +0000
@@ -15,25 +15,30 @@
#include <JavaScriptCore/JavaScript.h>
#include <glib/gi18n.h>
-#include <lightdm/greeter.h>
-
-static JSClassRef gettext_class, ldm_greeter_class, ldm_user_class, ldm_language_class, ldm_layout_class, ldm_session_class;
+#include <lightdm.h>
+
+#include <../config.h>
+
+static JSClassRef gettext_class, lightdm_greeter_class, lightdm_user_class, lightdm_language_class, lightdm_layout_class, lightdm_session_class;
static GtkWidget *web_view, *window;
static void
-show_prompt_cb (LdmGreeter *greeter, const gchar *text, WebKitWebView *view)
+show_prompt_cb (LightDMGreeter *greeter, const gchar *text, WebKitWebView *view)
{
gchar *command;
+ g_debug("Show prompt %s", text);
+
command = g_strdup_printf ("show_prompt('%s')", text); // FIXME: Escape text
- webkit_web_view_execute_script (view, command);
+ webkit_web_view_execute_script (web_view, command);
g_free (command);
}
static void
-show_message_cb (LdmGreeter *greeter, const gchar *text, WebKitWebView *view)
+show_message_cb (LightDMGreeter *greeter, const gchar *text, WebKitWebView *view)
{
+ g_debug("%s %d", __FUNCTION__, __LINE__);
gchar *command;
command = g_strdup_printf ("show_message('%s')", text); // FIXME: Escape text
@@ -42,13 +47,14 @@
}
static void
-authentication_complete_cb (LdmGreeter *greeter, WebKitWebView *view)
+authentication_complete_cb (LightDMGreeter *greeter, WebKitWebView *view)
{
+ g_debug("%s %d", __FUNCTION__, __LINE__);
webkit_web_view_execute_script (view, "authentication_complete()");
}
static void
-timed_login_cb (LdmGreeter *greeter, const gchar *username, WebKitWebView *view)
+timed_login_cb (LightDMGreeter *greeter, const gchar *username, WebKitWebView *view)
{
gchar *command;
@@ -60,6 +66,7 @@
static gboolean
fade_timer_cb (gpointer data)
{
+ g_debug("%s %d", __FUNCTION__, __LINE__);
gdouble opacity;
opacity = gtk_window_get_opacity (GTK_WINDOW (window));
@@ -75,7 +82,7 @@
}
static void
-quit_cb (LdmGreeter *greeter, const gchar *username)
+quit_cb (LightDMGreeter *greeter, const gchar *username)
{
/* Fade out the greeter */
g_timeout_add (40, (GSourceFunc) fade_timer_cb, NULL);
@@ -87,10 +94,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmUser *user = JSObjectGetPrivate (thisObject);
+ LightDMUser *user = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_user_get_name (user));
+ string = JSStringCreateWithUTF8CString (lightdm_user_get_name (user));
return JSValueMakeString (context, string);
}
@@ -100,10 +107,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmUser *user = JSObjectGetPrivate (thisObject);
+ LightDMUser *user = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_user_get_real_name (user));
+ string = JSStringCreateWithUTF8CString (lightdm_user_get_real_name (user));
return JSValueMakeString (context, string);
}
@@ -113,10 +120,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmUser *user = JSObjectGetPrivate (thisObject);
+ LightDMUser *user = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_user_get_display_name (user));
+ string = JSStringCreateWithUTF8CString (lightdm_user_get_display_name (user));
return JSValueMakeString (context, string);
}
@@ -126,10 +133,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmUser *user = JSObjectGetPrivate (thisObject);
+ LightDMUser *user = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_user_get_image (user));
+ string = JSStringCreateWithUTF8CString (lightdm_user_get_image (user));
return JSValueMakeString (context, string);
}
@@ -139,8 +146,8 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmUser *user = JSObjectGetPrivate (thisObject);
- const gchar *language = ldm_user_get_language (user);
+ LightDMUser *user = JSObjectGetPrivate (thisObject);
+ const gchar *language = lightdm_user_get_language (user);
JSStringRef string;
if (!language)
@@ -156,8 +163,8 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmUser *user = JSObjectGetPrivate (thisObject);
- const gchar *layout = ldm_user_get_layout (user);
+ LightDMUser *user = JSObjectGetPrivate (thisObject);
+ const gchar *layout = lightdm_user_get_layout (user);
JSStringRef string;
if (!layout)
@@ -173,8 +180,9 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmUser *user = JSObjectGetPrivate (thisObject);
- const gchar *session = ldm_user_get_session (user);
+ g_debug("%s %d", __FUNCTION__, __LINE__);
+ LightDMUser *user = JSObjectGetPrivate (thisObject);
+ const gchar *session = lightdm_user_get_session (user);
JSStringRef string;
if (!session)
@@ -190,8 +198,8 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmUser *user = JSObjectGetPrivate (thisObject);
- return JSValueMakeBoolean (context, ldm_user_get_logged_in (user));
+ LightDMUser *user = JSObjectGetPrivate (thisObject);
+ return JSValueMakeBoolean (context, lightdm_user_get_logged_in (user));
}
static JSValueRef
@@ -200,10 +208,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmLanguage *language = JSObjectGetPrivate (thisObject);
+ LightDMLanguage *language = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_language_get_code (language));
+ string = JSStringCreateWithUTF8CString (lightdm_language_get_code (language));
return JSValueMakeString (context, string);
}
@@ -213,10 +221,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmLanguage *language = JSObjectGetPrivate (thisObject);
+ LightDMLanguage *language = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_language_get_name (language));
+ string = JSStringCreateWithUTF8CString (lightdm_language_get_name (language));
return JSValueMakeString (context, string);
}
@@ -226,10 +234,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmLanguage *language = JSObjectGetPrivate (thisObject);
+ LightDMLanguage *language = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_language_get_territory (language));
+ string = JSStringCreateWithUTF8CString (lightdm_language_get_territory (language));
return JSValueMakeString (context, string);
}
@@ -239,10 +247,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmLayout *layout = JSObjectGetPrivate (thisObject);
+ LightDMLayout *layout = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_layout_get_name (layout));
+ string = JSStringCreateWithUTF8CString (lightdm_layout_get_name (layout));
return JSValueMakeString (context, string);
}
@@ -252,10 +260,11 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmLayout *layout = JSObjectGetPrivate (thisObject);
+ g_debug("%s %d", __FUNCTION__, __LINE__);
+ LightDMLayout *layout = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_layout_get_short_description (layout));
+ string = JSStringCreateWithUTF8CString (lightdm_layout_get_short_description (layout));
return JSValueMakeString (context, string);
}
@@ -265,10 +274,11 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmLayout *layout = JSObjectGetPrivate (thisObject);
+ g_debug("%s %d", __FUNCTION__, __LINE__);
+ LightDMLayout *layout = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_layout_get_description (layout));
+ string = JSStringCreateWithUTF8CString (lightdm_layout_get_description (layout));
return JSValueMakeString (context, string);
}
@@ -278,10 +288,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmSession *session = JSObjectGetPrivate (thisObject);
+ LightDMSession *session = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_session_get_key (session));
+ string = JSStringCreateWithUTF8CString (lightdm_session_get_key (session));
return JSValueMakeString (context, string);
}
@@ -291,10 +301,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmSession *session = JSObjectGetPrivate (thisObject);
+ LightDMSession *session = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_session_get_name (session));
+ string = JSStringCreateWithUTF8CString (lightdm_session_get_name (session));
return JSValueMakeString (context, string);
}
@@ -304,10 +314,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmSession *session = JSObjectGetPrivate (thisObject);
+ LightDMSession *session = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_session_get_comment (session));
+ string = JSStringCreateWithUTF8CString (lightdm_session_get_comment (session));
return JSValueMakeString (context, string);
}
@@ -317,10 +327,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_greeter_get_hostname (greeter));
+ string = JSStringCreateWithUTF8CString (lightdm_get_hostname ());
return JSValueMakeString (context, string);
}
@@ -331,10 +341,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
gint num_users;
- num_users = ldm_greeter_get_num_users (greeter);
+ num_users = g_list_length(lightdm_user_list_get_users (lightdm_user_list_get_instance()));
return JSValueMakeNumber (context, num_users);
}
@@ -344,20 +354,20 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
JSObjectRef array;
const GList *users, *link;
guint i, n_users = 0;
JSValueRef *args;
- users = ldm_greeter_get_users (greeter);
+ users = lightdm_user_list_get_users( lightdm_user_list_get_instance() );
n_users = g_list_length ((GList *)users);
args = g_malloc (sizeof (JSValueRef) * (n_users + 1));
for (i = 0, link = users; link; i++, link = link->next)
{
- LdmUser *user = link->data;
+ LightDMUser *user = link->data;
g_object_ref (user);
- args[i] = JSObjectMake (context, ldm_user_class, user);
+ args[i] = JSObjectMake (context, lightdm_user_class, user);
}
array = JSObjectMakeArray (context, n_users, args, NULL);
@@ -371,20 +381,19 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
JSObjectRef array;
const GList *languages, *link;
guint i, n_languages = 0;
JSValueRef *args;
- languages = ldm_greeter_get_languages (greeter);
+ languages = lightdm_get_languages ();
n_languages = g_list_length ((GList *)languages);
args = g_malloc (sizeof (JSValueRef) * (n_languages + 1));
for (i = 0, link = languages; link; i++, link = link->next)
{
- LdmLanguage *language = link->data;
+ LightDMLanguage *language = link->data;
g_object_ref (language);
- args[i] = JSObjectMake (context, ldm_language_class, language);
+ args[i] = JSObjectMake (context, lightdm_language_class, language);
}
array = JSObjectMakeArray (context, n_languages, args, NULL);
@@ -398,10 +407,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_greeter_get_default_language (greeter));
+ string = JSStringCreateWithUTF8CString (lightdm_language_get_name((LightDMLanguage *)lightdm_get_language ()));
return JSValueMakeString (context, string);
}
@@ -412,10 +421,9 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_greeter_get_default_layout (greeter));
+ string = JSStringCreateWithUTF8CString (lightdm_layout_get_name(lightdm_get_layout ()));
return JSValueMakeString (context, string);
}
@@ -426,20 +434,19 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
JSObjectRef array;
const GList *layouts, *link;
guint i, n_layouts = 0;
JSValueRef *args;
- layouts = ldm_greeter_get_layouts (greeter);
+ layouts = lightdm_get_layouts ();
n_layouts = g_list_length ((GList *)layouts);
args = g_malloc (sizeof (JSValueRef) * (n_layouts + 1));
for (i = 0, link = layouts; link; i++, link = link->next)
{
- LdmLayout *layout = link->data;
+ LightDMLayout *layout = link->data;
g_object_ref (layout);
- args[i] = JSObjectMake (context, ldm_layout_class, layout);
+ args[i] = JSObjectMake (context, lightdm_layout_class, layout);
}
array = JSObjectMakeArray (context, n_layouts, args, NULL);
@@ -453,10 +460,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
+ g_debug("%s %d", __FUNCTION__, __LINE__);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_greeter_get_layout (greeter));
+ string = JSStringCreateWithUTF8CString (lightdm_layout_get_name(lightdm_get_layout ()));
return JSValueMakeString (context, string);
}
@@ -468,7 +475,6 @@
JSValueRef value,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
JSStringRef layout_arg;
char layout[1024];
@@ -480,7 +486,7 @@
JSStringGetUTF8CString (layout_arg, layout, 1024);
JSStringRelease (layout_arg);
- ldm_greeter_set_layout (greeter, layout);
+ //lightdm_set_layout (layout);
return true;
}
@@ -491,20 +497,19 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
JSObjectRef array;
const GList *sessions, *link;
guint i, n_sessions = 0;
JSValueRef *args;
- sessions = ldm_greeter_get_sessions (greeter);
+ sessions = lightdm_get_sessions ();
n_sessions = g_list_length ((GList *)sessions);
args = g_malloc (sizeof (JSValueRef) * (n_sessions + 1));
for (i = 0, link = sessions; link; i++, link = link->next)
{
- LdmSession *session = link->data;
+ LightDMSession *session = link->data;
g_object_ref (session);
- args[i] = JSObjectMake (context, ldm_session_class, session);
+ args[i] = JSObjectMake (context, lightdm_session_class, session);
}
array = JSObjectMakeArray (context, n_sessions, args, NULL);
@@ -518,10 +523,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_greeter_get_default_session (greeter));
+ string = JSStringCreateWithUTF8CString (lightdm_greeter_get_default_session_hint (greeter));
return JSValueMakeString (context, string);
}
@@ -532,10 +537,10 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
JSStringRef string;
- string = JSStringCreateWithUTF8CString (ldm_greeter_get_timed_login_user (greeter));
+ string = JSStringCreateWithUTF8CString (lightdm_greeter_get_autologin_user_hint (greeter));
return JSValueMakeString (context, string);
}
@@ -546,91 +551,13 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
+ g_debug("%s %d", __FUNCTION__, __LINE__);
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
gint delay;
- delay = ldm_greeter_get_timed_login_delay (greeter);
+ delay = lightdm_greeter_get_autologin_timeout_hint (greeter);
return JSValueMakeNumber (context, delay);
}
-
-static JSValueRef
-get_string_property_cb (JSContextRef context,
- JSObjectRef function,
- JSObjectRef thisObject,
- size_t argumentCount,
- const JSValueRef arguments[],
- JSValueRef *exception)
-{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
- JSStringRef name_arg;
- char name[1024];
- gchar *value;
- JSStringRef string;
-
- // FIXME: Throw exception
- if (argumentCount != 1)
- return JSValueMakeNull (context);
-
- name_arg = JSValueToStringCopy (context, arguments[0], NULL);
- JSStringGetUTF8CString (name_arg, name, 1024);
- JSStringRelease (name_arg);
-
- value = ldm_greeter_get_string_property (greeter, name);
-
- if (!value)
- return JSValueMakeNull (context);
-
- string = JSStringCreateWithUTF8CString (value);
- g_free (value);
- return JSValueMakeString (context, string);
-}
-
-static JSValueRef
-get_integer_property_cb (JSContextRef context,
- JSObjectRef function,
- JSObjectRef thisObject,
- size_t argumentCount,
- const JSValueRef arguments[],
- JSValueRef *exception)
-{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
- JSStringRef name_arg;
- char name[1024];
-
- // FIXME: Throw exception
- if (argumentCount != 1)
- return JSValueMakeNull (context);
-
- name_arg = JSValueToStringCopy (context, arguments[0], NULL);
- JSStringGetUTF8CString (name_arg, name, 1024);
- JSStringRelease (name_arg);
-
- return JSValueMakeNumber (context, ldm_greeter_get_integer_property (greeter, name));
-}
-
-static JSValueRef
-get_boolean_property_cb (JSContextRef context,
- JSObjectRef function,
- JSObjectRef thisObject,
- size_t argumentCount,
- const JSValueRef arguments[],
- JSValueRef *exception)
-{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
- JSStringRef name_arg;
- char name[1024];
-
- // FIXME: Throw exception
- if (argumentCount != 1)
- return JSValueMakeNull (context);
-
- name_arg = JSValueToStringCopy (context, arguments[0], NULL);
- JSStringGetUTF8CString (name_arg, name, 1024);
- JSStringRelease (name_arg);
-
- return JSValueMakeBoolean (context, ldm_greeter_get_boolean_property (greeter, name));
-}
-
static JSValueRef
cancel_timed_login_cb (JSContextRef context,
JSObjectRef function,
@@ -639,13 +566,14 @@
const JSValueRef arguments[],
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
+ g_debug("%s %d", __FUNCTION__, __LINE__);
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
// FIXME: Throw exception
if (argumentCount != 0)
return JSValueMakeNull (context);
- ldm_greeter_cancel_timed_login (greeter);
+ lightdm_greeter_cancel_autologin (greeter);
return JSValueMakeNull (context);
}
@@ -657,7 +585,8 @@
const JSValueRef arguments[],
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
+ g_debug("%s %d", __FUNCTION__, __LINE__);
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
JSStringRef name_arg;
char name[1024];
@@ -669,7 +598,7 @@
JSStringGetUTF8CString (name_arg, name, 1024);
JSStringRelease (name_arg);
- ldm_greeter_start_authentication (greeter, name);
+ lightdm_greeter_authenticate (greeter, name);
return JSValueMakeNull (context);
}
@@ -681,11 +610,13 @@
const JSValueRef arguments[],
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
+ g_debug("%s %d", __FUNCTION__, __LINE__);
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
JSStringRef secret_arg;
char secret[1024];
// FIXME: Throw exception
+ g_debug("%d %d %d\n", argumentCount, argumentCount == 1, JSValueGetType (context, arguments[0]));
if (!(argumentCount == 1 && JSValueGetType (context, arguments[0]) == kJSTypeString))
return JSValueMakeNull (context);
@@ -693,7 +624,9 @@
JSStringGetUTF8CString (secret_arg, secret, 1024);
JSStringRelease (secret_arg);
- ldm_greeter_provide_secret (greeter, secret);
+ g_debug(secret);
+ // TODO
+ lightdm_greeter_respond (greeter, secret);
return JSValueMakeNull (context);
}
@@ -705,13 +638,13 @@
const JSValueRef arguments[],
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
// FIXME: Throw exception
if (argumentCount != 0)
return JSValueMakeNull (context);
- ldm_greeter_cancel_authentication (greeter);
+ lightdm_greeter_cancel_authentication (greeter);
return JSValueMakeNull (context);
}
@@ -721,8 +654,8 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
- return JSValueMakeString (context, JSStringCreateWithUTF8CString (ldm_greeter_get_authentication_user (greeter)));
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
+ return JSValueMakeString (context, JSStringCreateWithUTF8CString (lightdm_greeter_get_authentication_user (greeter)));
}
static JSValueRef
@@ -731,8 +664,8 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
- return JSValueMakeBoolean (context, ldm_greeter_get_is_authenticated (greeter));
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
+ return JSValueMakeBoolean (context, lightdm_greeter_get_is_authenticated (greeter));
}
static JSValueRef
@@ -741,8 +674,7 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
- return JSValueMakeBoolean (context, ldm_greeter_get_can_suspend (greeter));
+ return JSValueMakeBoolean (context, lightdm_get_can_suspend ());
}
static JSValueRef
@@ -753,13 +685,12 @@
const JSValueRef arguments[],
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
-
+ g_debug("%s %d", __FUNCTION__, __LINE__);
// FIXME: Throw exception
if (argumentCount != 0)
return JSValueMakeNull (context);
- ldm_greeter_suspend (greeter);
+ lightdm_suspend(NULL);
return JSValueMakeNull (context);
}
@@ -769,8 +700,8 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
- return JSValueMakeBoolean (context, ldm_greeter_get_can_hibernate (greeter));
+ g_debug("%s %d", __FUNCTION__, __LINE__);
+ return JSValueMakeBoolean (context, lightdm_get_can_hibernate ());
}
static JSValueRef
@@ -781,13 +712,12 @@
const JSValueRef arguments[],
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
-
+ g_debug("%s %d", __FUNCTION__, __LINE__);
// FIXME: Throw exception
if (argumentCount != 0)
return JSValueMakeNull (context);
- ldm_greeter_hibernate (greeter);
+ lightdm_hibernate (NULL);
return JSValueMakeNull (context);
}
@@ -797,8 +727,8 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
- return JSValueMakeBoolean (context, ldm_greeter_get_can_restart (greeter));
+ g_debug("%s %d", __FUNCTION__, __LINE__);
+ return JSValueMakeBoolean (context, lightdm_get_can_restart ());
}
static JSValueRef
@@ -809,13 +739,11 @@
const JSValueRef arguments[],
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
-
// FIXME: Throw exception
if (argumentCount != 0)
return JSValueMakeNull (context);
- ldm_greeter_restart (greeter);
+ lightdm_restart (NULL);
return JSValueMakeNull (context);
}
@@ -825,8 +753,7 @@
JSStringRef propertyName,
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
- return JSValueMakeBoolean (context, ldm_greeter_get_can_shutdown (greeter));
+ return JSValueMakeBoolean (context, lightdm_get_can_shutdown ());
}
static JSValueRef
@@ -837,13 +764,11 @@
const JSValueRef arguments[],
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
-
// FIXME: Throw exception
if (argumentCount != 0)
return JSValueMakeNull (context);
- ldm_greeter_shutdown (greeter);
+ lightdm_shutdown (NULL);
return JSValueMakeNull (context);
}
@@ -855,13 +780,12 @@
const JSValueRef arguments[],
JSValueRef *exception)
{
- LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
+ g_debug("%s", __FUNCTION__);
+ LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
JSStringRef arg;
char username[1024], *session = NULL, *language = NULL;
// FIXME: Throw exception
- if (argumentCount < 1 || argumentCount > 3)
- return JSValueMakeNull (context);
arg = JSValueToStringCopy (context, arguments[0], NULL);
JSStringGetUTF8CString (arg, username, 1024);
@@ -883,7 +807,7 @@
JSStringRelease (arg);
}
- ldm_greeter_login (greeter, username, session, language);
+ lightdm_greeter_start_session_sync (greeter, NULL, NULL);
g_free (session);
g_free (language);
@@ -898,6 +822,7 @@
const JSValueRef arguments[],
JSValueRef *exception)
{
+ g_debug("%s %d", __FUNCTION__, __LINE__);
JSStringRef string_arg, result;
char string[1024];
@@ -921,6 +846,7 @@
const JSValueRef arguments[],
JSValueRef *exception)
{
+ g_debug("%s %d", __FUNCTION__, __LINE__);
JSStringRef string_arg, plural_string_arg, result;
char string[1024], plural_string[1024];
unsigned int n;
@@ -943,7 +869,7 @@
return JSValueMakeString (context, result);
}
-static const JSStaticValue ldm_user_values[] =
+static const JSStaticValue lightdm_user_values[] =
{
{ "name", get_user_name_cb, NULL, kJSPropertyAttributeReadOnly },
{ "real_name", get_user_real_name_cb, NULL, kJSPropertyAttributeReadOnly },
@@ -956,7 +882,7 @@
{ NULL, NULL, NULL, 0 }
};
-static const JSStaticValue ldm_language_values[] =
+static const JSStaticValue lightdm_language_values[] =
{
{ "code", get_language_code_cb, NULL, kJSPropertyAttributeReadOnly },
{ "name", get_language_name_cb, NULL, kJSPropertyAttributeReadOnly },
@@ -964,7 +890,7 @@
{ NULL, NULL, NULL, 0 }
};
-static const JSStaticValue ldm_layout_values[] =
+static const JSStaticValue lightdm_layout_values[] =
{
{ "name", get_layout_name_cb, NULL, kJSPropertyAttributeReadOnly },
{ "short_description", get_layout_short_description_cb, NULL, kJSPropertyAttributeReadOnly },
@@ -972,7 +898,7 @@
{ NULL, NULL, NULL, 0 }
};
-static const JSStaticValue ldm_session_values[] =
+static const JSStaticValue lightdm_session_values[] =
{
{ "key", get_session_key_cb, NULL, kJSPropertyAttributeReadOnly },
{ "name", get_session_name_cb, NULL, kJSPropertyAttributeReadOnly },
@@ -980,7 +906,7 @@
{ NULL, NULL, NULL, 0 }
};
-static const JSStaticValue ldm_greeter_values[] =
+static const JSStaticValue lightdm_greeter_values[] =
{
{ "hostname", get_hostname_cb, NULL, kJSPropertyAttributeReadOnly },
{ "users", get_users_cb, NULL, kJSPropertyAttributeReadOnly },
@@ -1003,11 +929,8 @@
{ NULL, NULL, NULL, 0 }
};
-static const JSStaticFunction ldm_greeter_functions[] =
+static const JSStaticFunction lightdm_greeter_functions[] =
{
- { "get_string_property", get_string_property_cb, kJSPropertyAttributeReadOnly },
- { "get_integer_property", get_integer_property_cb, kJSPropertyAttributeReadOnly },
- { "get_boolean_property", get_boolean_property_cb, kJSPropertyAttributeReadOnly },
{ "cancel_timed_login", cancel_timed_login_cb, kJSPropertyAttributeReadOnly },
{ "start_authentication", start_authentication_cb, kJSPropertyAttributeReadOnly },
{ "provide_secret", provide_secret_cb, kJSPropertyAttributeReadOnly },
@@ -1027,50 +950,50 @@
{ NULL, NULL, 0 }
};
-static const JSClassDefinition ldm_user_definition =
-{
- 0, /* Version */
- kJSClassAttributeNone, /* Attributes */
- "LdmUser", /* Class name */
- NULL, /* Parent class */
- ldm_user_values, /* Static values */
-};
-
-static const JSClassDefinition ldm_language_definition =
-{
- 0, /* Version */
- kJSClassAttributeNone, /* Attributes */
- "LdmLanguage", /* Class name */
- NULL, /* Parent class */
- ldm_language_values, /* Static values */
-};
-
-static const JSClassDefinition ldm_layout_definition =
-{
- 0, /* Version */
- kJSClassAttributeNone, /* Attributes */
- "LdmLayout", /* Class name */
- NULL, /* Parent class */
- ldm_layout_values, /* Static values */
-};
-
-static const JSClassDefinition ldm_session_definition =
-{
- 0, /* Version */
- kJSClassAttributeNone, /* Attributes */
- "LdmSession", /* Class name */
- NULL, /* Parent class */
- ldm_session_values, /* Static values */
-};
-
-static const JSClassDefinition ldm_greeter_definition =
-{
- 0, /* Version */
- kJSClassAttributeNone, /* Attributes */
- "LdmGreeter", /* Class name */
- NULL, /* Parent class */
- ldm_greeter_values, /* Static values */
- ldm_greeter_functions, /* Static functions */
+static const JSClassDefinition lightdm_user_definition =
+{
+ 0, /* Version */
+ kJSClassAttributeNone, /* Attributes */
+ "LightDMUser", /* Class name */
+ NULL, /* Parent class */
+ lightdm_user_values, /* Static values */
+};
+
+static const JSClassDefinition lightdm_language_definition =
+{
+ 0, /* Version */
+ kJSClassAttributeNone, /* Attributes */
+ "LightDMLanguage", /* Class name */
+ NULL, /* Parent class */
+ lightdm_language_values, /* Static values */
+};
+
+static const JSClassDefinition lightdm_layout_definition =
+{
+ 0, /* Version */
+ kJSClassAttributeNone, /* Attributes */
+ "LightDMLayout", /* Class name */
+ NULL, /* Parent class */
+ lightdm_layout_values, /* Static values */
+};
+
+static const JSClassDefinition lightdm_session_definition =
+{
+ 0, /* Version */
+ kJSClassAttributeNone, /* Attributes */
+ "LightDMSession", /* Class name */
+ NULL, /* Parent class */
+ lightdm_session_values, /* Static values */
+};
+
+static const JSClassDefinition lightdm_greeter_definition =
+{
+ 0, /* Version */
+ kJSClassAttributeNone, /* Attributes */
+ "LightDMGreeter", /* Class name */
+ NULL, /* Parent class */
+ lightdm_greeter_values, /* Static values */
+ lightdm_greeter_functions, /* Static functions */
};
static const JSClassDefinition gettext_definition =
@@ -1088,16 +1011,17 @@
WebKitWebFrame *frame,
JSGlobalContextRef context,
JSObjectRef window_object,
- LdmGreeter *greeter)
+ LightDMGreeter *greeter)
{
- JSObjectRef gettext_object, ldm_greeter_object;
+ g_debug("%s %d", __FUNCTION__, __LINE__);
+ JSObjectRef gettext_object, lightdm_greeter_object;
gettext_class = JSClassCreate (&gettext_definition);
- ldm_greeter_class = JSClassCreate (&ldm_greeter_definition);
- ldm_user_class = JSClassCreate (&ldm_user_definition);
- ldm_language_class = JSClassCreate (&ldm_language_definition);
- ldm_layout_class = JSClassCreate (&ldm_layout_definition);
- ldm_session_class = JSClassCreate (&ldm_session_definition);
+ lightdm_greeter_class = JSClassCreate (&lightdm_greeter_definition);
+ lightdm_user_class = JSClassCreate (&lightdm_user_definition);
+ lightdm_language_class = JSClassCreate (&lightdm_language_definition);
+ lightdm_layout_class = JSClassCreate (&lightdm_layout_definition);
+ lightdm_session_class = JSClassCreate (&lightdm_session_definition);
gettext_object = JSObjectMake (context, gettext_class, NULL);
JSObjectSetProperty (context,
@@ -1105,11 +1029,11 @@
JSStringCreateWithUTF8CString ("gettext"),
gettext_object, kJSPropertyAttributeNone, NULL);
- ldm_greeter_object = JSObjectMake (context, ldm_greeter_class, greeter);
+ lightdm_greeter_object = JSObjectMake (context, lightdm_greeter_class, greeter);
JSObjectSetProperty (context,
JSContextGetGlobalObject (context),
JSStringCreateWithUTF8CString ("lightdm"),
- ldm_greeter_object, kJSPropertyAttributeNone, NULL);
+ lightdm_greeter_object, kJSPropertyAttributeNone, NULL);
}
static void
@@ -1119,23 +1043,23 @@
}
static void
-connected_cb (LdmGreeter *greeter)
+connected_cb (LightDMGreeter *greeter)
{
+ g_debug("%s %d", __FUNCTION__, __LINE__);
gchar *url;
- url = ldm_greeter_get_string_property (greeter, "url");
+ url = "index.html";
if (url)
{
gchar *theme_dir, *rel_url;
- theme_dir = g_path_get_dirname (ldm_greeter_get_theme (greeter));
+ theme_dir = g_path_get_dirname ("/usr/share/lightdm/elementary/");
rel_url = url;
url = g_strdup_printf ("file://%s/%s", theme_dir, rel_url);
g_free (theme_dir);
g_free (rel_url);
g_debug ("Showing URL %s", url);
- webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), url);
g_free (url);
}
else
@@ -1147,40 +1071,45 @@
int
main (int argc, char **argv)
{
- LdmGreeter *greeter;
- GdkDisplay *display;
+ LightDMGreeter *greeter;
GdkScreen *screen;
- gint screen_width, screen_height;
+ GdkRectangle geometry;
signal (SIGTERM, sigterm_cb);
gtk_init (&argc, &argv);
-
- greeter = ldm_greeter_new ();
-
- display = gdk_display_get_default ();
- screen = gdk_display_get_default_screen (display);
- screen_width = gdk_screen_get_width (screen);
- screen_height = gdk_screen_get_height (screen);
+ gdk_window_set_cursor (gdk_get_default_root_window (), gdk_cursor_new (GDK_LEFT_PTR));
+ greeter = lightdm_greeter_new ();
+
+ /* settings */
+ GKeyFile* keyfile = g_key_file_new();
+ g_key_file_load_from_file(keyfile, "/etc/lightdm/lightdm-webkit-greeter.conf", G_KEY_FILE_NONE, NULL);
+ gchar* theme = g_key_file_get_string(keyfile, "greeter", "webkit-theme", NULL);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size (GTK_WINDOW (window), screen_width, screen_height);
- gtk_window_fullscreen (GTK_WINDOW (window));
+ screen = gtk_window_get_screen (window);
+ gdk_screen_get_monitor_geometry (screen, gdk_screen_get_primary_monitor(screen), &geometry);
+ gtk_window_set_default_size (window, geometry.width, geometry.height);
+ gtk_window_move (window, geometry.x, geometry.y);
web_view = webkit_web_view_new ();
g_signal_connect (G_OBJECT (web_view), "window-object-cleared", G_CALLBACK (window_object_cleared_cb), greeter);
gtk_container_add (GTK_CONTAINER (window), web_view);
- g_signal_connect (G_OBJECT (greeter), "connected", G_CALLBACK (connected_cb), web_view);
+ //g_signal_connect (G_OBJECT (greeter), "connected", G_CALLBACK (connected_cb), web_view);
g_signal_connect (G_OBJECT (greeter), "show-prompt", G_CALLBACK (show_prompt_cb), web_view);
g_signal_connect (G_OBJECT (greeter), "show-message", G_CALLBACK (show_message_cb), web_view);
g_signal_connect (G_OBJECT (greeter), "show-error", G_CALLBACK (show_message_cb), web_view);
g_signal_connect (G_OBJECT (greeter), "authentication-complete", G_CALLBACK (authentication_complete_cb), web_view);
- g_signal_connect (G_OBJECT (greeter), "timed-login", G_CALLBACK (timed_login_cb), web_view);
+ //g_signal_connect (G_OBJECT (greeter), "timed-login", G_CALLBACK (timed_login_cb), web_view);
g_signal_connect (G_OBJECT (greeter), "quit", G_CALLBACK (quit_cb), web_view);
- ldm_greeter_connect_to_server (greeter);
-
+ //lightdm_greeter_connect_to_server (greeter);
+
+ webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), g_strdup_printf("file://%s/%s/index.html", THEME_DIR, theme));
+
+ gtk_widget_show_all (window);
+lightdm_greeter_connect_sync (greeter, NULL);
gtk_main ();
return 0;
Follow ups