Merge lp:~elementaryart/lightdm-webkit-greeter/fixes into lp:~lightdm-team/lightdm-webkit-greeter/trunk

Proposed by Fabian Thoma
Status: Merged
Merged at revision: 9
Proposed branch: lp:~elementaryart/lightdm-webkit-greeter/fixes
Merge into: lp:~lightdm-team/lightdm-webkit-greeter/trunk
Diff against target: 1220 lines (+247/-280)
5 files modified
Makefile.am (+3/-0)
configure.ac (+22/-5)
lightdm-webkit-greeter.conf (+18/-0)
src/Makefile.am (+1/-1)
src/lightdm-webkit-greeter.c (+203/-274)
To merge this branch: bzr merge lp:~elementaryart/lightdm-webkit-greeter/fixes
Reviewer Review Type Date Requested Status
LightDM Development Team Pending
Review via email: mp+75400@code.launchpad.net

Description of the change

Fixed the greeter to work with the latest lightdm in Oneiric

To post a comment you must log in.
18. By <Fabian Thoma <email address hidden>

Fixed small bug with sessions not beeing properly handled

19. By <Fabian Thoma <email address hidden>

switched default theme name to "default" instead of "webkit" to make it more readable; also needed for using alternatives system on debian

20. By Sergey "Shnatsel" Davidoff

revision bump to make recipe work

21. By Sergey "Shnatsel" Davidoff

revision bump to make recipe work

22. By Sergey "Shnatsel" Davidoff

fixed rev 19

23. By Sergey "Shnatsel" Davidoff

revision bump to make recipe work

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile.am'
--- Makefile.am 2011-02-12 00:33:07 +0000
+++ Makefile.am 2011-09-24 19:06:23 +0000
@@ -18,3 +18,6 @@
18 omf.make \18 omf.make \
19 xmldocs.make \19 xmldocs.make \
20 po/Makefile.in.in20 po/Makefile.in.in
21
22etcdir = /etc/lightdm/
23etc_DATA = lightdm-webkit-greeter.conf
2124
=== modified file 'configure.ac'
--- configure.ac 2011-05-20 05:03:42 +0000
+++ configure.ac 2011-09-24 19:06:23 +0000
@@ -2,6 +2,7 @@
22
3AC_INIT(lightdm-webkit-greeter, 0.1.0)3AC_INIT(lightdm-webkit-greeter, 0.1.0)
4AC_CONFIG_MACRO_DIR(m4)4AC_CONFIG_MACRO_DIR(m4)
5AC_SUBST(THEME_DIR)
5AC_CONFIG_HEADER(config.h)6AC_CONFIG_HEADER(config.h)
6AM_INIT_AUTOMAKE7AM_INIT_AUTOMAKE
7AM_PROG_CC_C_O8AM_PROG_CC_C_O
@@ -15,7 +16,7 @@
15dnl ###########################################################################16dnl ###########################################################################
1617
17PKG_CHECK_MODULES(GREETER, [18PKG_CHECK_MODULES(GREETER, [
18 liblightdm-gobject-019 liblightdm-gobject-1
19 gtk+-2.020 gtk+-2.0
20 webkit-1.021 webkit-1.0
21 dbus-glib-122 dbus-glib-1
@@ -24,11 +25,27 @@
24dnl ###########################################################################25dnl ###########################################################################
25dnl Configurable values26dnl Configurable values
26dnl ###########################################################################27dnl ###########################################################################
27THEME_DIR=`$PKG_CONFIG --define-variable=prefix=$prefix --variable=themedir liblightdm-gobject-0`28THEME_DIR="/usr/share/lightdm-webkit/themes/"
29AC_ARG_WITH(theme-dir,
30 AS_HELP_STRING(--with-theme-dir=<path>,
31 Theme directory to use for webkit themes),
32 if test x$withval != x; then
33 THEME_DIR="$withval"
34 fi
35)
28AC_SUBST(THEME_DIR)36AC_SUBST(THEME_DIR)
37AC_DEFINE_UNQUOTED(THEME_DIR, "$THEME_DIR", Theme Dir)
2938
30GREETER_DIR=`$PKG_CONFIG --define-variable=prefix=$prefix --variable=greeterdir liblightdm-gobject-0`39CONFIG_DIR="/etc/lightdm/"
31AC_SUBST(GREETER_DIR)40AC_ARG_WITH(config-dir,
41 AS_HELP_STRING(--with-config-dir=<path>,
42 Configuration directory of lightdm),
43 if test x$withval != x; then
44 CONFIG_DIR="$withval"
45 fi
46)
47AC_SUBST(CONFIG_DIR)
48AC_DEFINE_UNQUOTED(CONFIG_DIR, "$CONFIG_DIR", Config Dir)
3249
33dnl ###########################################################################50dnl ###########################################################################
34dnl Internationalization51dnl Internationalization
@@ -60,5 +77,5 @@
6077
61 prefix: $prefix78 prefix: $prefix
62 Theme directory: $THEME_DIR79 Theme directory: $THEME_DIR
63 Greeter directory: $GREETER_DIR80 Configuration directory: $CONFIG_DIR
64"81"
6582
=== added file 'lightdm-webkit-greeter.conf'
--- lightdm-webkit-greeter.conf 1970-01-01 00:00:00 +0000
+++ lightdm-webkit-greeter.conf 2011-09-24 19:06:23 +0000
@@ -0,0 +1,18 @@
1#
2# background = Background file to use, either an image path or a color (e.g. #772953)
3# theme-name = GTK+ theme to use
4# font-name = Font to use
5# xft-antialias = Whether to antialias Xft fonts (true or false)
6# xft-dpi = Resolution for Xft in dots per inch (e.g. 96)
7# xft-hintstyle = What degree of hinting to use (hintnone, hintslight, hintmedium, or hintfull)
8# xft-rgba = Type of subpixel antialiasing (none, rgb, bgr, vrgb or vbgr)
9#
10[greeter]
11background=/usr/share/backgrounds/warty-final-ubuntu.png
12theme-name=Ambiance
13webkit-theme=default
14font-name=Ubuntu 11
15xft-antialias=true
16xft-dpi=96
17xft-hintstyle=slight
18xft-rgba=rgb
019
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2011-05-20 05:03:42 +0000
+++ src/Makefile.am 2011-09-24 19:06:23 +0000
@@ -1,5 +1,5 @@
1greeter_PROGRAMS = lightdm-webkit-greeter1greeter_PROGRAMS = lightdm-webkit-greeter
2greeterdir = $(GREETER_DIR)2greeterdir = $(bindir)
33
4lightdm_webkit_greeter_SOURCES = \4lightdm_webkit_greeter_SOURCES = \
5 lightdm-webkit-greeter.c5 lightdm-webkit-greeter.c
66
=== 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-24 19:06:23 +0000
@@ -15,25 +15,30 @@
15#include <JavaScriptCore/JavaScript.h>15#include <JavaScriptCore/JavaScript.h>
16#include <glib/gi18n.h>16#include <glib/gi18n.h>
1717
18#include <lightdm/greeter.h>18#include <lightdm.h>
1919
20static JSClassRef gettext_class, ldm_greeter_class, ldm_user_class, ldm_language_class, ldm_layout_class, ldm_session_class;20#include <../config.h>
21
22static JSClassRef gettext_class, lightdm_greeter_class, lightdm_user_class, lightdm_language_class, lightdm_layout_class, lightdm_session_class;
2123
22static GtkWidget *web_view, *window;24static GtkWidget *web_view, *window;
2325
24static void26static void
25show_prompt_cb (LdmGreeter *greeter, const gchar *text, WebKitWebView *view)27show_prompt_cb (LightDMGreeter *greeter, const gchar *text, WebKitWebView *view)
26{28{
27 gchar *command;29 gchar *command;
2830
31 g_debug("Show prompt %s", text);
32
29 command = g_strdup_printf ("show_prompt('%s')", text); // FIXME: Escape text33 command = g_strdup_printf ("show_prompt('%s')", text); // FIXME: Escape text
30 webkit_web_view_execute_script (view, command);34 webkit_web_view_execute_script (web_view, command);
31 g_free (command);35 g_free (command);
32}36}
3337
34static void38static void
35show_message_cb (LdmGreeter *greeter, const gchar *text, WebKitWebView *view)39show_message_cb (LightDMGreeter *greeter, const gchar *text, WebKitWebView *view)
36{40{
41 g_debug("%s %d", __FUNCTION__, __LINE__);
37 gchar *command;42 gchar *command;
3843
39 command = g_strdup_printf ("show_message('%s')", text); // FIXME: Escape text44 command = g_strdup_printf ("show_message('%s')", text); // FIXME: Escape text
@@ -42,13 +47,14 @@
42}47}
4348
44static void49static void
45authentication_complete_cb (LdmGreeter *greeter, WebKitWebView *view)50authentication_complete_cb (LightDMGreeter *greeter, WebKitWebView *view)
46{51{
52 g_debug("%s %d", __FUNCTION__, __LINE__);
47 webkit_web_view_execute_script (view, "authentication_complete()");53 webkit_web_view_execute_script (view, "authentication_complete()");
48}54}
4955
50static void56static void
51timed_login_cb (LdmGreeter *greeter, const gchar *username, WebKitWebView *view)57timed_login_cb (LightDMGreeter *greeter, const gchar *username, WebKitWebView *view)
52{58{
53 gchar *command;59 gchar *command;
5460
@@ -60,6 +66,7 @@
60static gboolean66static gboolean
61fade_timer_cb (gpointer data)67fade_timer_cb (gpointer data)
62{68{
69 g_debug("%s %d", __FUNCTION__, __LINE__);
63 gdouble opacity;70 gdouble opacity;
6471
65 opacity = gtk_window_get_opacity (GTK_WINDOW (window));72 opacity = gtk_window_get_opacity (GTK_WINDOW (window));
@@ -75,7 +82,7 @@
75}82}
7683
77static void84static void
78quit_cb (LdmGreeter *greeter, const gchar *username)85quit_cb (LightDMGreeter *greeter, const gchar *username)
79{86{
80 /* Fade out the greeter */87 /* Fade out the greeter */
81 g_timeout_add (40, (GSourceFunc) fade_timer_cb, NULL);88 g_timeout_add (40, (GSourceFunc) fade_timer_cb, NULL);
@@ -87,10 +94,10 @@
87 JSStringRef propertyName,94 JSStringRef propertyName,
88 JSValueRef *exception)95 JSValueRef *exception)
89{96{
90 LdmUser *user = JSObjectGetPrivate (thisObject);97 LightDMUser *user = JSObjectGetPrivate (thisObject);
91 JSStringRef string;98 JSStringRef string;
9299
93 string = JSStringCreateWithUTF8CString (ldm_user_get_name (user));100 string = JSStringCreateWithUTF8CString (lightdm_user_get_name (user));
94 return JSValueMakeString (context, string);101 return JSValueMakeString (context, string);
95}102}
96103
@@ -100,10 +107,10 @@
100 JSStringRef propertyName,107 JSStringRef propertyName,
101 JSValueRef *exception)108 JSValueRef *exception)
102{109{
103 LdmUser *user = JSObjectGetPrivate (thisObject);110 LightDMUser *user = JSObjectGetPrivate (thisObject);
104 JSStringRef string;111 JSStringRef string;
105112
106 string = JSStringCreateWithUTF8CString (ldm_user_get_real_name (user));113 string = JSStringCreateWithUTF8CString (lightdm_user_get_real_name (user));
107 return JSValueMakeString (context, string);114 return JSValueMakeString (context, string);
108}115}
109116
@@ -113,10 +120,10 @@
113 JSStringRef propertyName,120 JSStringRef propertyName,
114 JSValueRef *exception)121 JSValueRef *exception)
115{122{
116 LdmUser *user = JSObjectGetPrivate (thisObject);123 LightDMUser *user = JSObjectGetPrivate (thisObject);
117 JSStringRef string;124 JSStringRef string;
118125
119 string = JSStringCreateWithUTF8CString (ldm_user_get_display_name (user));126 string = JSStringCreateWithUTF8CString (lightdm_user_get_display_name (user));
120 return JSValueMakeString (context, string);127 return JSValueMakeString (context, string);
121}128}
122129
@@ -126,10 +133,10 @@
126 JSStringRef propertyName,133 JSStringRef propertyName,
127 JSValueRef *exception)134 JSValueRef *exception)
128{135{
129 LdmUser *user = JSObjectGetPrivate (thisObject);136 LightDMUser *user = JSObjectGetPrivate (thisObject);
130 JSStringRef string;137 JSStringRef string;
131138
132 string = JSStringCreateWithUTF8CString (ldm_user_get_image (user));139 string = JSStringCreateWithUTF8CString (lightdm_user_get_image (user));
133 return JSValueMakeString (context, string);140 return JSValueMakeString (context, string);
134}141}
135142
@@ -139,8 +146,8 @@
139 JSStringRef propertyName,146 JSStringRef propertyName,
140 JSValueRef *exception)147 JSValueRef *exception)
141{148{
142 LdmUser *user = JSObjectGetPrivate (thisObject);149 LightDMUser *user = JSObjectGetPrivate (thisObject);
143 const gchar *language = ldm_user_get_language (user);150 const gchar *language = lightdm_user_get_language (user);
144 JSStringRef string;151 JSStringRef string;
145152
146 if (!language)153 if (!language)
@@ -156,8 +163,8 @@
156 JSStringRef propertyName,163 JSStringRef propertyName,
157 JSValueRef *exception)164 JSValueRef *exception)
158{165{
159 LdmUser *user = JSObjectGetPrivate (thisObject);166 LightDMUser *user = JSObjectGetPrivate (thisObject);
160 const gchar *layout = ldm_user_get_layout (user);167 const gchar *layout = lightdm_user_get_layout (user);
161 JSStringRef string;168 JSStringRef string;
162169
163 if (!layout)170 if (!layout)
@@ -173,8 +180,9 @@
173 JSStringRef propertyName,180 JSStringRef propertyName,
174 JSValueRef *exception)181 JSValueRef *exception)
175{182{
176 LdmUser *user = JSObjectGetPrivate (thisObject);183 g_debug("%s %d", __FUNCTION__, __LINE__);
177 const gchar *session = ldm_user_get_session (user);184 LightDMUser *user = JSObjectGetPrivate (thisObject);
185 const gchar *session = lightdm_user_get_session (user);
178 JSStringRef string;186 JSStringRef string;
179187
180 if (!session)188 if (!session)
@@ -190,8 +198,8 @@
190 JSStringRef propertyName,198 JSStringRef propertyName,
191 JSValueRef *exception)199 JSValueRef *exception)
192{200{
193 LdmUser *user = JSObjectGetPrivate (thisObject);201 LightDMUser *user = JSObjectGetPrivate (thisObject);
194 return JSValueMakeBoolean (context, ldm_user_get_logged_in (user));202 return JSValueMakeBoolean (context, lightdm_user_get_logged_in (user));
195}203}
196204
197static JSValueRef205static JSValueRef
@@ -200,10 +208,10 @@
200 JSStringRef propertyName,208 JSStringRef propertyName,
201 JSValueRef *exception)209 JSValueRef *exception)
202{210{
203 LdmLanguage *language = JSObjectGetPrivate (thisObject);211 LightDMLanguage *language = JSObjectGetPrivate (thisObject);
204 JSStringRef string;212 JSStringRef string;
205213
206 string = JSStringCreateWithUTF8CString (ldm_language_get_code (language));214 string = JSStringCreateWithUTF8CString (lightdm_language_get_code (language));
207 return JSValueMakeString (context, string);215 return JSValueMakeString (context, string);
208}216}
209217
@@ -213,10 +221,10 @@
213 JSStringRef propertyName,221 JSStringRef propertyName,
214 JSValueRef *exception)222 JSValueRef *exception)
215{223{
216 LdmLanguage *language = JSObjectGetPrivate (thisObject);224 LightDMLanguage *language = JSObjectGetPrivate (thisObject);
217 JSStringRef string;225 JSStringRef string;
218226
219 string = JSStringCreateWithUTF8CString (ldm_language_get_name (language));227 string = JSStringCreateWithUTF8CString (lightdm_language_get_name (language));
220 return JSValueMakeString (context, string);228 return JSValueMakeString (context, string);
221}229}
222230
@@ -226,10 +234,10 @@
226 JSStringRef propertyName,234 JSStringRef propertyName,
227 JSValueRef *exception)235 JSValueRef *exception)
228{236{
229 LdmLanguage *language = JSObjectGetPrivate (thisObject);237 LightDMLanguage *language = JSObjectGetPrivate (thisObject);
230 JSStringRef string;238 JSStringRef string;
231239
232 string = JSStringCreateWithUTF8CString (ldm_language_get_territory (language));240 string = JSStringCreateWithUTF8CString (lightdm_language_get_territory (language));
233 return JSValueMakeString (context, string);241 return JSValueMakeString (context, string);
234}242}
235243
@@ -239,10 +247,10 @@
239 JSStringRef propertyName,247 JSStringRef propertyName,
240 JSValueRef *exception)248 JSValueRef *exception)
241{249{
242 LdmLayout *layout = JSObjectGetPrivate (thisObject);250 LightDMLayout *layout = JSObjectGetPrivate (thisObject);
243 JSStringRef string;251 JSStringRef string;
244252
245 string = JSStringCreateWithUTF8CString (ldm_layout_get_name (layout));253 string = JSStringCreateWithUTF8CString (lightdm_layout_get_name (layout));
246 return JSValueMakeString (context, string);254 return JSValueMakeString (context, string);
247}255}
248256
@@ -252,10 +260,11 @@
252 JSStringRef propertyName,260 JSStringRef propertyName,
253 JSValueRef *exception)261 JSValueRef *exception)
254{262{
255 LdmLayout *layout = JSObjectGetPrivate (thisObject);263 g_debug("%s %d", __FUNCTION__, __LINE__);
264 LightDMLayout *layout = JSObjectGetPrivate (thisObject);
256 JSStringRef string;265 JSStringRef string;
257266
258 string = JSStringCreateWithUTF8CString (ldm_layout_get_short_description (layout));267 string = JSStringCreateWithUTF8CString (lightdm_layout_get_short_description (layout));
259 return JSValueMakeString (context, string);268 return JSValueMakeString (context, string);
260}269}
261270
@@ -265,10 +274,11 @@
265 JSStringRef propertyName,274 JSStringRef propertyName,
266 JSValueRef *exception)275 JSValueRef *exception)
267{276{
268 LdmLayout *layout = JSObjectGetPrivate (thisObject);277 g_debug("%s %d", __FUNCTION__, __LINE__);
278 LightDMLayout *layout = JSObjectGetPrivate (thisObject);
269 JSStringRef string;279 JSStringRef string;
270280
271 string = JSStringCreateWithUTF8CString (ldm_layout_get_description (layout));281 string = JSStringCreateWithUTF8CString (lightdm_layout_get_description (layout));
272 return JSValueMakeString (context, string);282 return JSValueMakeString (context, string);
273}283}
274284
@@ -278,10 +288,10 @@
278 JSStringRef propertyName,288 JSStringRef propertyName,
279 JSValueRef *exception)289 JSValueRef *exception)
280{290{
281 LdmSession *session = JSObjectGetPrivate (thisObject);291 LightDMSession *session = JSObjectGetPrivate (thisObject);
282 JSStringRef string;292 JSStringRef string;
283293
284 string = JSStringCreateWithUTF8CString (ldm_session_get_key (session));294 string = JSStringCreateWithUTF8CString (lightdm_session_get_key (session));
285 return JSValueMakeString (context, string);295 return JSValueMakeString (context, string);
286296
287}297}
@@ -291,10 +301,10 @@
291 JSStringRef propertyName,301 JSStringRef propertyName,
292 JSValueRef *exception)302 JSValueRef *exception)
293{303{
294 LdmSession *session = JSObjectGetPrivate (thisObject);304 LightDMSession *session = JSObjectGetPrivate (thisObject);
295 JSStringRef string;305 JSStringRef string;
296306
297 string = JSStringCreateWithUTF8CString (ldm_session_get_name (session));307 string = JSStringCreateWithUTF8CString (lightdm_session_get_name (session));
298 return JSValueMakeString (context, string);308 return JSValueMakeString (context, string);
299}309}
300310
@@ -304,10 +314,10 @@
304 JSStringRef propertyName,314 JSStringRef propertyName,
305 JSValueRef *exception)315 JSValueRef *exception)
306{316{
307 LdmSession *session = JSObjectGetPrivate (thisObject);317 LightDMSession *session = JSObjectGetPrivate (thisObject);
308 JSStringRef string;318 JSStringRef string;
309319
310 string = JSStringCreateWithUTF8CString (ldm_session_get_comment (session));320 string = JSStringCreateWithUTF8CString (lightdm_session_get_comment (session));
311 return JSValueMakeString (context, string);321 return JSValueMakeString (context, string);
312}322}
313323
@@ -317,10 +327,10 @@
317 JSStringRef propertyName,327 JSStringRef propertyName,
318 JSValueRef *exception)328 JSValueRef *exception)
319{329{
320 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);330 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
321 JSStringRef string;331 JSStringRef string;
322332
323 string = JSStringCreateWithUTF8CString (ldm_greeter_get_hostname (greeter));333 string = JSStringCreateWithUTF8CString (lightdm_get_hostname ());
324334
325 return JSValueMakeString (context, string);335 return JSValueMakeString (context, string);
326}336}
@@ -331,10 +341,10 @@
331 JSStringRef propertyName,341 JSStringRef propertyName,
332 JSValueRef *exception)342 JSValueRef *exception)
333{343{
334 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);344 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
335 gint num_users;345 gint num_users;
336346
337 num_users = ldm_greeter_get_num_users (greeter);347 num_users = g_list_length(lightdm_user_list_get_users (lightdm_user_list_get_instance()));
338 return JSValueMakeNumber (context, num_users);348 return JSValueMakeNumber (context, num_users);
339}349}
340350
@@ -344,20 +354,20 @@
344 JSStringRef propertyName,354 JSStringRef propertyName,
345 JSValueRef *exception)355 JSValueRef *exception)
346{356{
347 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);357 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
348 JSObjectRef array;358 JSObjectRef array;
349 const GList *users, *link;359 const GList *users, *link;
350 guint i, n_users = 0;360 guint i, n_users = 0;
351 JSValueRef *args;361 JSValueRef *args;
352362
353 users = ldm_greeter_get_users (greeter);363 users = lightdm_user_list_get_users( lightdm_user_list_get_instance() );
354 n_users = g_list_length ((GList *)users);364 n_users = g_list_length ((GList *)users);
355 args = g_malloc (sizeof (JSValueRef) * (n_users + 1));365 args = g_malloc (sizeof (JSValueRef) * (n_users + 1));
356 for (i = 0, link = users; link; i++, link = link->next)366 for (i = 0, link = users; link; i++, link = link->next)
357 {367 {
358 LdmUser *user = link->data;368 LightDMUser *user = link->data;
359 g_object_ref (user);369 g_object_ref (user);
360 args[i] = JSObjectMake (context, ldm_user_class, user);370 args[i] = JSObjectMake (context, lightdm_user_class, user);
361 }371 }
362372
363 array = JSObjectMakeArray (context, n_users, args, NULL);373 array = JSObjectMakeArray (context, n_users, args, NULL);
@@ -371,20 +381,19 @@
371 JSStringRef propertyName,381 JSStringRef propertyName,
372 JSValueRef *exception)382 JSValueRef *exception)
373{383{
374 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
375 JSObjectRef array;384 JSObjectRef array;
376 const GList *languages, *link;385 const GList *languages, *link;
377 guint i, n_languages = 0;386 guint i, n_languages = 0;
378 JSValueRef *args;387 JSValueRef *args;
379388
380 languages = ldm_greeter_get_languages (greeter);389 languages = lightdm_get_languages ();
381 n_languages = g_list_length ((GList *)languages);390 n_languages = g_list_length ((GList *)languages);
382 args = g_malloc (sizeof (JSValueRef) * (n_languages + 1));391 args = g_malloc (sizeof (JSValueRef) * (n_languages + 1));
383 for (i = 0, link = languages; link; i++, link = link->next)392 for (i = 0, link = languages; link; i++, link = link->next)
384 {393 {
385 LdmLanguage *language = link->data;394 LightDMLanguage *language = link->data;
386 g_object_ref (language);395 g_object_ref (language);
387 args[i] = JSObjectMake (context, ldm_language_class, language);396 args[i] = JSObjectMake (context, lightdm_language_class, language);
388 }397 }
389398
390 array = JSObjectMakeArray (context, n_languages, args, NULL);399 array = JSObjectMakeArray (context, n_languages, args, NULL);
@@ -398,10 +407,10 @@
398 JSStringRef propertyName,407 JSStringRef propertyName,
399 JSValueRef *exception)408 JSValueRef *exception)
400{409{
401 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);410 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
402 JSStringRef string;411 JSStringRef string;
403412
404 string = JSStringCreateWithUTF8CString (ldm_greeter_get_default_language (greeter));413 string = JSStringCreateWithUTF8CString (lightdm_language_get_name((LightDMLanguage *)lightdm_get_language ()));
405414
406 return JSValueMakeString (context, string);415 return JSValueMakeString (context, string);
407}416}
@@ -412,10 +421,9 @@
412 JSStringRef propertyName,421 JSStringRef propertyName,
413 JSValueRef *exception)422 JSValueRef *exception)
414{423{
415 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
416 JSStringRef string;424 JSStringRef string;
417425
418 string = JSStringCreateWithUTF8CString (ldm_greeter_get_default_layout (greeter));426 string = JSStringCreateWithUTF8CString (lightdm_layout_get_name(lightdm_get_layout ()));
419427
420 return JSValueMakeString (context, string);428 return JSValueMakeString (context, string);
421}429}
@@ -426,20 +434,19 @@
426 JSStringRef propertyName,434 JSStringRef propertyName,
427 JSValueRef *exception)435 JSValueRef *exception)
428{436{
429 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
430 JSObjectRef array;437 JSObjectRef array;
431 const GList *layouts, *link;438 const GList *layouts, *link;
432 guint i, n_layouts = 0;439 guint i, n_layouts = 0;
433 JSValueRef *args;440 JSValueRef *args;
434441
435 layouts = ldm_greeter_get_layouts (greeter);442 layouts = lightdm_get_layouts ();
436 n_layouts = g_list_length ((GList *)layouts);443 n_layouts = g_list_length ((GList *)layouts);
437 args = g_malloc (sizeof (JSValueRef) * (n_layouts + 1));444 args = g_malloc (sizeof (JSValueRef) * (n_layouts + 1));
438 for (i = 0, link = layouts; link; i++, link = link->next)445 for (i = 0, link = layouts; link; i++, link = link->next)
439 {446 {
440 LdmLayout *layout = link->data;447 LightDMLayout *layout = link->data;
441 g_object_ref (layout);448 g_object_ref (layout);
442 args[i] = JSObjectMake (context, ldm_layout_class, layout);449 args[i] = JSObjectMake (context, lightdm_layout_class, layout);
443 }450 }
444451
445 array = JSObjectMakeArray (context, n_layouts, args, NULL);452 array = JSObjectMakeArray (context, n_layouts, args, NULL);
@@ -453,10 +460,10 @@
453 JSStringRef propertyName,460 JSStringRef propertyName,
454 JSValueRef *exception)461 JSValueRef *exception)
455{462{
456 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);463 g_debug("%s %d", __FUNCTION__, __LINE__);
457 JSStringRef string;464 JSStringRef string;
458465
459 string = JSStringCreateWithUTF8CString (ldm_greeter_get_layout (greeter));466 string = JSStringCreateWithUTF8CString (lightdm_layout_get_name(lightdm_get_layout ()));
460467
461 return JSValueMakeString (context, string);468 return JSValueMakeString (context, string);
462}469}
@@ -468,7 +475,6 @@
468 JSValueRef value,475 JSValueRef value,
469 JSValueRef *exception)476 JSValueRef *exception)
470{477{
471 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
472 JSStringRef layout_arg;478 JSStringRef layout_arg;
473 char layout[1024];479 char layout[1024];
474480
@@ -480,7 +486,7 @@
480 JSStringGetUTF8CString (layout_arg, layout, 1024);486 JSStringGetUTF8CString (layout_arg, layout, 1024);
481 JSStringRelease (layout_arg);487 JSStringRelease (layout_arg);
482488
483 ldm_greeter_set_layout (greeter, layout);489 //lightdm_set_layout (layout);
484490
485 return true;491 return true;
486}492}
@@ -491,20 +497,19 @@
491 JSStringRef propertyName,497 JSStringRef propertyName,
492 JSValueRef *exception)498 JSValueRef *exception)
493{499{
494 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
495 JSObjectRef array;500 JSObjectRef array;
496 const GList *sessions, *link;501 const GList *sessions, *link;
497 guint i, n_sessions = 0;502 guint i, n_sessions = 0;
498 JSValueRef *args;503 JSValueRef *args;
499504
500 sessions = ldm_greeter_get_sessions (greeter);505 sessions = lightdm_get_sessions ();
501 n_sessions = g_list_length ((GList *)sessions);506 n_sessions = g_list_length ((GList *)sessions);
502 args = g_malloc (sizeof (JSValueRef) * (n_sessions + 1));507 args = g_malloc (sizeof (JSValueRef) * (n_sessions + 1));
503 for (i = 0, link = sessions; link; i++, link = link->next)508 for (i = 0, link = sessions; link; i++, link = link->next)
504 {509 {
505 LdmSession *session = link->data;510 LightDMSession *session = link->data;
506 g_object_ref (session);511 g_object_ref (session);
507 args[i] = JSObjectMake (context, ldm_session_class, session);512 args[i] = JSObjectMake (context, lightdm_session_class, session);
508 }513 }
509514
510 array = JSObjectMakeArray (context, n_sessions, args, NULL);515 array = JSObjectMakeArray (context, n_sessions, args, NULL);
@@ -518,10 +523,10 @@
518 JSStringRef propertyName,523 JSStringRef propertyName,
519 JSValueRef *exception)524 JSValueRef *exception)
520{525{
521 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);526 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
522 JSStringRef string;527 JSStringRef string;
523528
524 string = JSStringCreateWithUTF8CString (ldm_greeter_get_default_session (greeter));529 string = JSStringCreateWithUTF8CString (lightdm_greeter_get_default_session_hint (greeter));
525530
526 return JSValueMakeString (context, string);531 return JSValueMakeString (context, string);
527}532}
@@ -532,10 +537,10 @@
532 JSStringRef propertyName,537 JSStringRef propertyName,
533 JSValueRef *exception)538 JSValueRef *exception)
534{539{
535 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);540 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
536 JSStringRef string;541 JSStringRef string;
537542
538 string = JSStringCreateWithUTF8CString (ldm_greeter_get_timed_login_user (greeter));543 string = JSStringCreateWithUTF8CString (lightdm_greeter_get_autologin_user_hint (greeter));
539544
540 return JSValueMakeString (context, string);545 return JSValueMakeString (context, string);
541}546}
@@ -546,91 +551,13 @@
546 JSStringRef propertyName,551 JSStringRef propertyName,
547 JSValueRef *exception)552 JSValueRef *exception)
548{553{
549 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);554 g_debug("%s %d", __FUNCTION__, __LINE__);
555 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
550 gint delay;556 gint delay;
551557
552 delay = ldm_greeter_get_timed_login_delay (greeter);558 delay = lightdm_greeter_get_autologin_timeout_hint (greeter);
553 return JSValueMakeNumber (context, delay);559 return JSValueMakeNumber (context, delay);
554}560}
555
556static JSValueRef
557get_string_property_cb (JSContextRef context,
558 JSObjectRef function,
559 JSObjectRef thisObject,
560 size_t argumentCount,
561 const JSValueRef arguments[],
562 JSValueRef *exception)
563{
564 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
565 JSStringRef name_arg;
566 char name[1024];
567 gchar *value;
568 JSStringRef string;
569
570 // FIXME: Throw exception
571 if (argumentCount != 1)
572 return JSValueMakeNull (context);
573
574 name_arg = JSValueToStringCopy (context, arguments[0], NULL);
575 JSStringGetUTF8CString (name_arg, name, 1024);
576 JSStringRelease (name_arg);
577
578 value = ldm_greeter_get_string_property (greeter, name);
579
580 if (!value)
581 return JSValueMakeNull (context);
582
583 string = JSStringCreateWithUTF8CString (value);
584 g_free (value);
585 return JSValueMakeString (context, string);
586}
587
588static JSValueRef
589get_integer_property_cb (JSContextRef context,
590 JSObjectRef function,
591 JSObjectRef thisObject,
592 size_t argumentCount,
593 const JSValueRef arguments[],
594 JSValueRef *exception)
595{
596 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
597 JSStringRef name_arg;
598 char name[1024];
599
600 // FIXME: Throw exception
601 if (argumentCount != 1)
602 return JSValueMakeNull (context);
603
604 name_arg = JSValueToStringCopy (context, arguments[0], NULL);
605 JSStringGetUTF8CString (name_arg, name, 1024);
606 JSStringRelease (name_arg);
607
608 return JSValueMakeNumber (context, ldm_greeter_get_integer_property (greeter, name));
609}
610
611static JSValueRef
612get_boolean_property_cb (JSContextRef context,
613 JSObjectRef function,
614 JSObjectRef thisObject,
615 size_t argumentCount,
616 const JSValueRef arguments[],
617 JSValueRef *exception)
618{
619 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
620 JSStringRef name_arg;
621 char name[1024];
622
623 // FIXME: Throw exception
624 if (argumentCount != 1)
625 return JSValueMakeNull (context);
626
627 name_arg = JSValueToStringCopy (context, arguments[0], NULL);
628 JSStringGetUTF8CString (name_arg, name, 1024);
629 JSStringRelease (name_arg);
630
631 return JSValueMakeBoolean (context, ldm_greeter_get_boolean_property (greeter, name));
632}
633
634static JSValueRef561static JSValueRef
635cancel_timed_login_cb (JSContextRef context,562cancel_timed_login_cb (JSContextRef context,
636 JSObjectRef function,563 JSObjectRef function,
@@ -639,13 +566,14 @@
639 const JSValueRef arguments[],566 const JSValueRef arguments[],
640 JSValueRef *exception)567 JSValueRef *exception)
641{568{
642 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);569 g_debug("%s %d", __FUNCTION__, __LINE__);
570 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
643571
644 // FIXME: Throw exception572 // FIXME: Throw exception
645 if (argumentCount != 0)573 if (argumentCount != 0)
646 return JSValueMakeNull (context);574 return JSValueMakeNull (context);
647575
648 ldm_greeter_cancel_timed_login (greeter);576 lightdm_greeter_cancel_autologin (greeter);
649 return JSValueMakeNull (context);577 return JSValueMakeNull (context);
650}578}
651579
@@ -657,7 +585,8 @@
657 const JSValueRef arguments[],585 const JSValueRef arguments[],
658 JSValueRef *exception)586 JSValueRef *exception)
659{587{
660 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);588 g_debug("%s %d", __FUNCTION__, __LINE__);
589 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
661 JSStringRef name_arg;590 JSStringRef name_arg;
662 char name[1024];591 char name[1024];
663592
@@ -669,7 +598,7 @@
669 JSStringGetUTF8CString (name_arg, name, 1024);598 JSStringGetUTF8CString (name_arg, name, 1024);
670 JSStringRelease (name_arg);599 JSStringRelease (name_arg);
671600
672 ldm_greeter_start_authentication (greeter, name);601 lightdm_greeter_authenticate (greeter, name);
673 return JSValueMakeNull (context);602 return JSValueMakeNull (context);
674}603}
675604
@@ -681,11 +610,13 @@
681 const JSValueRef arguments[],610 const JSValueRef arguments[],
682 JSValueRef *exception)611 JSValueRef *exception)
683{612{
684 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);613 g_debug("%s %d", __FUNCTION__, __LINE__);
614 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
685 JSStringRef secret_arg;615 JSStringRef secret_arg;
686 char secret[1024];616 char secret[1024];
687617
688 // FIXME: Throw exception618 // FIXME: Throw exception
619 g_debug("%d %d %d\n", argumentCount, argumentCount == 1, JSValueGetType (context, arguments[0]));
689 if (!(argumentCount == 1 && JSValueGetType (context, arguments[0]) == kJSTypeString))620 if (!(argumentCount == 1 && JSValueGetType (context, arguments[0]) == kJSTypeString))
690 return JSValueMakeNull (context);621 return JSValueMakeNull (context);
691622
@@ -693,7 +624,9 @@
693 JSStringGetUTF8CString (secret_arg, secret, 1024);624 JSStringGetUTF8CString (secret_arg, secret, 1024);
694 JSStringRelease (secret_arg);625 JSStringRelease (secret_arg);
695626
696 ldm_greeter_provide_secret (greeter, secret);627 g_debug(secret);
628 // TODO
629 lightdm_greeter_respond (greeter, secret);
697 return JSValueMakeNull (context);630 return JSValueMakeNull (context);
698}631}
699632
@@ -705,13 +638,13 @@
705 const JSValueRef arguments[],638 const JSValueRef arguments[],
706 JSValueRef *exception)639 JSValueRef *exception)
707{640{
708 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);641 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
709642
710 // FIXME: Throw exception643 // FIXME: Throw exception
711 if (argumentCount != 0)644 if (argumentCount != 0)
712 return JSValueMakeNull (context);645 return JSValueMakeNull (context);
713646
714 ldm_greeter_cancel_authentication (greeter);647 lightdm_greeter_cancel_authentication (greeter);
715 return JSValueMakeNull (context);648 return JSValueMakeNull (context);
716}649}
717650
@@ -721,8 +654,8 @@
721 JSStringRef propertyName,654 JSStringRef propertyName,
722 JSValueRef *exception)655 JSValueRef *exception)
723{656{
724 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);657 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
725 return JSValueMakeString (context, JSStringCreateWithUTF8CString (ldm_greeter_get_authentication_user (greeter)));658 return JSValueMakeString (context, JSStringCreateWithUTF8CString (lightdm_greeter_get_authentication_user (greeter)));
726}659}
727660
728static JSValueRef661static JSValueRef
@@ -731,8 +664,8 @@
731 JSStringRef propertyName,664 JSStringRef propertyName,
732 JSValueRef *exception)665 JSValueRef *exception)
733{666{
734 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);667 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
735 return JSValueMakeBoolean (context, ldm_greeter_get_is_authenticated (greeter));668 return JSValueMakeBoolean (context, lightdm_greeter_get_is_authenticated (greeter));
736}669}
737670
738static JSValueRef671static JSValueRef
@@ -741,8 +674,7 @@
741 JSStringRef propertyName,674 JSStringRef propertyName,
742 JSValueRef *exception)675 JSValueRef *exception)
743{676{
744 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);677 return JSValueMakeBoolean (context, lightdm_get_can_suspend ());
745 return JSValueMakeBoolean (context, ldm_greeter_get_can_suspend (greeter));
746}678}
747679
748static JSValueRef680static JSValueRef
@@ -753,13 +685,12 @@
753 const JSValueRef arguments[],685 const JSValueRef arguments[],
754 JSValueRef *exception)686 JSValueRef *exception)
755{687{
756 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);688 g_debug("%s %d", __FUNCTION__, __LINE__);
757
758 // FIXME: Throw exception689 // FIXME: Throw exception
759 if (argumentCount != 0)690 if (argumentCount != 0)
760 return JSValueMakeNull (context);691 return JSValueMakeNull (context);
761692
762 ldm_greeter_suspend (greeter);693 lightdm_suspend(NULL);
763 return JSValueMakeNull (context);694 return JSValueMakeNull (context);
764}695}
765696
@@ -769,8 +700,8 @@
769 JSStringRef propertyName,700 JSStringRef propertyName,
770 JSValueRef *exception)701 JSValueRef *exception)
771{702{
772 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);703 g_debug("%s %d", __FUNCTION__, __LINE__);
773 return JSValueMakeBoolean (context, ldm_greeter_get_can_hibernate (greeter));704 return JSValueMakeBoolean (context, lightdm_get_can_hibernate ());
774}705}
775706
776static JSValueRef707static JSValueRef
@@ -781,13 +712,12 @@
781 const JSValueRef arguments[],712 const JSValueRef arguments[],
782 JSValueRef *exception)713 JSValueRef *exception)
783{714{
784 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);715 g_debug("%s %d", __FUNCTION__, __LINE__);
785
786 // FIXME: Throw exception716 // FIXME: Throw exception
787 if (argumentCount != 0)717 if (argumentCount != 0)
788 return JSValueMakeNull (context);718 return JSValueMakeNull (context);
789719
790 ldm_greeter_hibernate (greeter);720 lightdm_hibernate (NULL);
791 return JSValueMakeNull (context);721 return JSValueMakeNull (context);
792}722}
793723
@@ -797,8 +727,8 @@
797 JSStringRef propertyName,727 JSStringRef propertyName,
798 JSValueRef *exception)728 JSValueRef *exception)
799{729{
800 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);730 g_debug("%s %d", __FUNCTION__, __LINE__);
801 return JSValueMakeBoolean (context, ldm_greeter_get_can_restart (greeter));731 return JSValueMakeBoolean (context, lightdm_get_can_restart ());
802}732}
803733
804static JSValueRef734static JSValueRef
@@ -809,13 +739,11 @@
809 const JSValueRef arguments[],739 const JSValueRef arguments[],
810 JSValueRef *exception)740 JSValueRef *exception)
811{741{
812 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
813
814 // FIXME: Throw exception742 // FIXME: Throw exception
815 if (argumentCount != 0)743 if (argumentCount != 0)
816 return JSValueMakeNull (context);744 return JSValueMakeNull (context);
817745
818 ldm_greeter_restart (greeter);746 lightdm_restart (NULL);
819 return JSValueMakeNull (context);747 return JSValueMakeNull (context);
820}748}
821749
@@ -825,8 +753,7 @@
825 JSStringRef propertyName,753 JSStringRef propertyName,
826 JSValueRef *exception)754 JSValueRef *exception)
827{755{
828 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);756 return JSValueMakeBoolean (context, lightdm_get_can_shutdown ());
829 return JSValueMakeBoolean (context, ldm_greeter_get_can_shutdown (greeter));
830}757}
831758
832static JSValueRef759static JSValueRef
@@ -837,13 +764,11 @@
837 const JSValueRef arguments[],764 const JSValueRef arguments[],
838 JSValueRef *exception)765 JSValueRef *exception)
839{766{
840 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
841
842 // FIXME: Throw exception767 // FIXME: Throw exception
843 if (argumentCount != 0)768 if (argumentCount != 0)
844 return JSValueMakeNull (context);769 return JSValueMakeNull (context);
845770
846 ldm_greeter_shutdown (greeter);771 lightdm_shutdown (NULL);
847 return JSValueMakeNull (context);772 return JSValueMakeNull (context);
848}773}
849774
@@ -855,13 +780,12 @@
855 const JSValueRef arguments[],780 const JSValueRef arguments[],
856 JSValueRef *exception)781 JSValueRef *exception)
857{782{
858 LdmGreeter *greeter = JSObjectGetPrivate (thisObject);783 g_debug("%s", __FUNCTION__);
784 LightDMGreeter *greeter = JSObjectGetPrivate (thisObject);
859 JSStringRef arg;785 JSStringRef arg;
860 char username[1024], *session = NULL, *language = NULL;786 char username[1024], *session = NULL, *language = NULL;
861787
862 // FIXME: Throw exception788 // FIXME: Throw exception
863 if (argumentCount < 1 || argumentCount > 3)
864 return JSValueMakeNull (context);
865789
866 arg = JSValueToStringCopy (context, arguments[0], NULL);790 arg = JSValueToStringCopy (context, arguments[0], NULL);
867 JSStringGetUTF8CString (arg, username, 1024);791 JSStringGetUTF8CString (arg, username, 1024);
@@ -883,7 +807,7 @@
883 JSStringRelease (arg);807 JSStringRelease (arg);
884 }808 }
885809
886 ldm_greeter_login (greeter, username, session, language);810 lightdm_greeter_start_session_sync (greeter, session, NULL);
887 g_free (session);811 g_free (session);
888 g_free (language);812 g_free (language);
889813
@@ -898,6 +822,7 @@
898 const JSValueRef arguments[],822 const JSValueRef arguments[],
899 JSValueRef *exception)823 JSValueRef *exception)
900{824{
825 g_debug("%s %d", __FUNCTION__, __LINE__);
901 JSStringRef string_arg, result;826 JSStringRef string_arg, result;
902 char string[1024];827 char string[1024];
903828
@@ -921,6 +846,7 @@
921 const JSValueRef arguments[],846 const JSValueRef arguments[],
922 JSValueRef *exception)847 JSValueRef *exception)
923{848{
849 g_debug("%s %d", __FUNCTION__, __LINE__);
924 JSStringRef string_arg, plural_string_arg, result;850 JSStringRef string_arg, plural_string_arg, result;
925 char string[1024], plural_string[1024];851 char string[1024], plural_string[1024];
926 unsigned int n;852 unsigned int n;
@@ -943,7 +869,7 @@
943 return JSValueMakeString (context, result);869 return JSValueMakeString (context, result);
944}870}
945871
946static const JSStaticValue ldm_user_values[] =872static const JSStaticValue lightdm_user_values[] =
947{873{
948 { "name", get_user_name_cb, NULL, kJSPropertyAttributeReadOnly },874 { "name", get_user_name_cb, NULL, kJSPropertyAttributeReadOnly },
949 { "real_name", get_user_real_name_cb, NULL, kJSPropertyAttributeReadOnly },875 { "real_name", get_user_real_name_cb, NULL, kJSPropertyAttributeReadOnly },
@@ -956,7 +882,7 @@
956 { NULL, NULL, NULL, 0 }882 { NULL, NULL, NULL, 0 }
957};883};
958884
959static const JSStaticValue ldm_language_values[] =885static const JSStaticValue lightdm_language_values[] =
960{886{
961 { "code", get_language_code_cb, NULL, kJSPropertyAttributeReadOnly },887 { "code", get_language_code_cb, NULL, kJSPropertyAttributeReadOnly },
962 { "name", get_language_name_cb, NULL, kJSPropertyAttributeReadOnly },888 { "name", get_language_name_cb, NULL, kJSPropertyAttributeReadOnly },
@@ -964,7 +890,7 @@
964 { NULL, NULL, NULL, 0 }890 { NULL, NULL, NULL, 0 }
965};891};
966892
967static const JSStaticValue ldm_layout_values[] =893static const JSStaticValue lightdm_layout_values[] =
968{894{
969 { "name", get_layout_name_cb, NULL, kJSPropertyAttributeReadOnly },895 { "name", get_layout_name_cb, NULL, kJSPropertyAttributeReadOnly },
970 { "short_description", get_layout_short_description_cb, NULL, kJSPropertyAttributeReadOnly },896 { "short_description", get_layout_short_description_cb, NULL, kJSPropertyAttributeReadOnly },
@@ -972,7 +898,7 @@
972 { NULL, NULL, NULL, 0 }898 { NULL, NULL, NULL, 0 }
973};899};
974900
975static const JSStaticValue ldm_session_values[] =901static const JSStaticValue lightdm_session_values[] =
976{902{
977 { "key", get_session_key_cb, NULL, kJSPropertyAttributeReadOnly },903 { "key", get_session_key_cb, NULL, kJSPropertyAttributeReadOnly },
978 { "name", get_session_name_cb, NULL, kJSPropertyAttributeReadOnly },904 { "name", get_session_name_cb, NULL, kJSPropertyAttributeReadOnly },
@@ -980,7 +906,7 @@
980 { NULL, NULL, NULL, 0 }906 { NULL, NULL, NULL, 0 }
981};907};
982908
983static const JSStaticValue ldm_greeter_values[] =909static const JSStaticValue lightdm_greeter_values[] =
984{910{
985 { "hostname", get_hostname_cb, NULL, kJSPropertyAttributeReadOnly },911 { "hostname", get_hostname_cb, NULL, kJSPropertyAttributeReadOnly },
986 { "users", get_users_cb, NULL, kJSPropertyAttributeReadOnly },912 { "users", get_users_cb, NULL, kJSPropertyAttributeReadOnly },
@@ -1003,11 +929,8 @@
1003 { NULL, NULL, NULL, 0 }929 { NULL, NULL, NULL, 0 }
1004};930};
1005931
1006static const JSStaticFunction ldm_greeter_functions[] =932static const JSStaticFunction lightdm_greeter_functions[] =
1007{933{
1008 { "get_string_property", get_string_property_cb, kJSPropertyAttributeReadOnly },
1009 { "get_integer_property", get_integer_property_cb, kJSPropertyAttributeReadOnly },
1010 { "get_boolean_property", get_boolean_property_cb, kJSPropertyAttributeReadOnly },
1011 { "cancel_timed_login", cancel_timed_login_cb, kJSPropertyAttributeReadOnly },934 { "cancel_timed_login", cancel_timed_login_cb, kJSPropertyAttributeReadOnly },
1012 { "start_authentication", start_authentication_cb, kJSPropertyAttributeReadOnly },935 { "start_authentication", start_authentication_cb, kJSPropertyAttributeReadOnly },
1013 { "provide_secret", provide_secret_cb, kJSPropertyAttributeReadOnly },936 { "provide_secret", provide_secret_cb, kJSPropertyAttributeReadOnly },
@@ -1027,50 +950,50 @@
1027 { NULL, NULL, 0 }950 { NULL, NULL, 0 }
1028};951};
1029952
1030static const JSClassDefinition ldm_user_definition =953static const JSClassDefinition lightdm_user_definition =
1031{954{
1032 0, /* Version */955 0, /* Version */
1033 kJSClassAttributeNone, /* Attributes */956 kJSClassAttributeNone, /* Attributes */
1034 "LdmUser", /* Class name */957 "LightDMUser", /* Class name */
1035 NULL, /* Parent class */958 NULL, /* Parent class */
1036 ldm_user_values, /* Static values */959 lightdm_user_values, /* Static values */
1037};960};
1038961
1039static const JSClassDefinition ldm_language_definition =962static const JSClassDefinition lightdm_language_definition =
1040{963{
1041 0, /* Version */964 0, /* Version */
1042 kJSClassAttributeNone, /* Attributes */965 kJSClassAttributeNone, /* Attributes */
1043 "LdmLanguage", /* Class name */966 "LightDMLanguage", /* Class name */
1044 NULL, /* Parent class */967 NULL, /* Parent class */
1045 ldm_language_values, /* Static values */968 lightdm_language_values, /* Static values */
1046};969};
1047970
1048static const JSClassDefinition ldm_layout_definition =971static const JSClassDefinition lightdm_layout_definition =
1049{972{
1050 0, /* Version */973 0, /* Version */
1051 kJSClassAttributeNone, /* Attributes */974 kJSClassAttributeNone, /* Attributes */
1052 "LdmLayout", /* Class name */975 "LightDMLayout", /* Class name */
1053 NULL, /* Parent class */976 NULL, /* Parent class */
1054 ldm_layout_values, /* Static values */977 lightdm_layout_values, /* Static values */
1055};978};
1056979
1057static const JSClassDefinition ldm_session_definition =980static const JSClassDefinition lightdm_session_definition =
1058{981{
1059 0, /* Version */982 0, /* Version */
1060 kJSClassAttributeNone, /* Attributes */983 kJSClassAttributeNone, /* Attributes */
1061 "LdmSession", /* Class name */984 "LightDMSession", /* Class name */
1062 NULL, /* Parent class */985 NULL, /* Parent class */
1063 ldm_session_values, /* Static values */986 lightdm_session_values, /* Static values */
1064};987};
1065988
1066static const JSClassDefinition ldm_greeter_definition =989static const JSClassDefinition lightdm_greeter_definition =
1067{990{
1068 0, /* Version */991 0, /* Version */
1069 kJSClassAttributeNone, /* Attributes */992 kJSClassAttributeNone, /* Attributes */
1070 "LdmGreeter", /* Class name */993 "LightDMGreeter", /* Class name */
1071 NULL, /* Parent class */994 NULL, /* Parent class */
1072 ldm_greeter_values, /* Static values */995 lightdm_greeter_values, /* Static values */
1073 ldm_greeter_functions, /* Static functions */996 lightdm_greeter_functions, /* Static functions */
1074};997};
1075998
1076static const JSClassDefinition gettext_definition =999static const JSClassDefinition gettext_definition =
@@ -1088,16 +1011,17 @@
1088 WebKitWebFrame *frame,1011 WebKitWebFrame *frame,
1089 JSGlobalContextRef context,1012 JSGlobalContextRef context,
1090 JSObjectRef window_object,1013 JSObjectRef window_object,
1091 LdmGreeter *greeter)1014 LightDMGreeter *greeter)
1092{1015{
1093 JSObjectRef gettext_object, ldm_greeter_object;1016 g_debug("%s %d", __FUNCTION__, __LINE__);
1017 JSObjectRef gettext_object, lightdm_greeter_object;
10941018
1095 gettext_class = JSClassCreate (&gettext_definition);1019 gettext_class = JSClassCreate (&gettext_definition);
1096 ldm_greeter_class = JSClassCreate (&ldm_greeter_definition);1020 lightdm_greeter_class = JSClassCreate (&lightdm_greeter_definition);
1097 ldm_user_class = JSClassCreate (&ldm_user_definition);1021 lightdm_user_class = JSClassCreate (&lightdm_user_definition);
1098 ldm_language_class = JSClassCreate (&ldm_language_definition);1022 lightdm_language_class = JSClassCreate (&lightdm_language_definition);
1099 ldm_layout_class = JSClassCreate (&ldm_layout_definition);1023 lightdm_layout_class = JSClassCreate (&lightdm_layout_definition);
1100 ldm_session_class = JSClassCreate (&ldm_session_definition);1024 lightdm_session_class = JSClassCreate (&lightdm_session_definition);
11011025
1102 gettext_object = JSObjectMake (context, gettext_class, NULL);1026 gettext_object = JSObjectMake (context, gettext_class, NULL);
1103 JSObjectSetProperty (context,1027 JSObjectSetProperty (context,
@@ -1105,11 +1029,11 @@
1105 JSStringCreateWithUTF8CString ("gettext"),1029 JSStringCreateWithUTF8CString ("gettext"),
1106 gettext_object, kJSPropertyAttributeNone, NULL);1030 gettext_object, kJSPropertyAttributeNone, NULL);
11071031
1108 ldm_greeter_object = JSObjectMake (context, ldm_greeter_class, greeter);1032 lightdm_greeter_object = JSObjectMake (context, lightdm_greeter_class, greeter);
1109 JSObjectSetProperty (context,1033 JSObjectSetProperty (context,
1110 JSContextGetGlobalObject (context),1034 JSContextGetGlobalObject (context),
1111 JSStringCreateWithUTF8CString ("lightdm"),1035 JSStringCreateWithUTF8CString ("lightdm"),
1112 ldm_greeter_object, kJSPropertyAttributeNone, NULL);1036 lightdm_greeter_object, kJSPropertyAttributeNone, NULL);
1113}1037}
11141038
1115static void1039static void
@@ -1119,23 +1043,23 @@
1119}1043}
11201044
1121static void1045static void
1122connected_cb (LdmGreeter *greeter)1046connected_cb (LightDMGreeter *greeter)
1123{1047{
1048 g_debug("%s %d", __FUNCTION__, __LINE__);
1124 gchar *url;1049 gchar *url;
11251050
1126 url = ldm_greeter_get_string_property (greeter, "url");1051 url = "index.html";
1127 if (url)1052 if (url)
1128 {1053 {
1129 gchar *theme_dir, *rel_url;1054 gchar *theme_dir, *rel_url;
11301055
1131 theme_dir = g_path_get_dirname (ldm_greeter_get_theme (greeter));1056 theme_dir = g_path_get_dirname ("/usr/share/lightdm/elementary/");
1132 rel_url = url;1057 rel_url = url;
1133 url = g_strdup_printf ("file://%s/%s", theme_dir, rel_url);1058 url = g_strdup_printf ("file://%s/%s", theme_dir, rel_url);
1134 g_free (theme_dir);1059 g_free (theme_dir);
1135 g_free (rel_url);1060 g_free (rel_url);
11361061
1137 g_debug ("Showing URL %s", url);1062 g_debug ("Showing URL %s", url);
1138 webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), url);
1139 g_free (url);1063 g_free (url);
1140 }1064 }
1141 else1065 else
@@ -1147,40 +1071,45 @@
1147int1071int
1148main (int argc, char **argv)1072main (int argc, char **argv)
1149{1073{
1150 LdmGreeter *greeter;1074 LightDMGreeter *greeter;
1151 GdkDisplay *display;
1152 GdkScreen *screen;1075 GdkScreen *screen;
1153 gint screen_width, screen_height;1076 GdkRectangle geometry;
11541077
1155 signal (SIGTERM, sigterm_cb);1078 signal (SIGTERM, sigterm_cb);
11561079
1157 gtk_init (&argc, &argv);1080 gtk_init (&argc, &argv);
11581081 gdk_window_set_cursor (gdk_get_default_root_window (), gdk_cursor_new (GDK_LEFT_PTR));
1159 greeter = ldm_greeter_new ();1082 greeter = lightdm_greeter_new ();
11601083
1161 display = gdk_display_get_default ();1084 /* settings */
1162 screen = gdk_display_get_default_screen (display);1085 GKeyFile* keyfile = g_key_file_new();
1163 screen_width = gdk_screen_get_width (screen);1086 g_key_file_load_from_file(keyfile, "/etc/lightdm/lightdm-webkit-greeter.conf", G_KEY_FILE_NONE, NULL);
1164 screen_height = gdk_screen_get_height (screen);1087 gchar* theme = g_key_file_get_string(keyfile, "greeter", "webkit-theme", NULL);
11651088
1166 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);1089 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
1167 gtk_window_set_default_size (GTK_WINDOW (window), screen_width, screen_height);1090 screen = gtk_window_get_screen (window);
1168 gtk_window_fullscreen (GTK_WINDOW (window));1091 gdk_screen_get_monitor_geometry (screen, gdk_screen_get_primary_monitor(screen), &geometry);
1092 gtk_window_set_default_size (window, geometry.width, geometry.height);
1093 gtk_window_move (window, geometry.x, geometry.y);
11691094
1170 web_view = webkit_web_view_new ();1095 web_view = webkit_web_view_new ();
1171 g_signal_connect (G_OBJECT (web_view), "window-object-cleared", G_CALLBACK (window_object_cleared_cb), greeter);1096 g_signal_connect (G_OBJECT (web_view), "window-object-cleared", G_CALLBACK (window_object_cleared_cb), greeter);
1172 gtk_container_add (GTK_CONTAINER (window), web_view);1097 gtk_container_add (GTK_CONTAINER (window), web_view);
11731098
1174 g_signal_connect (G_OBJECT (greeter), "connected", G_CALLBACK (connected_cb), web_view); 1099 //g_signal_connect (G_OBJECT (greeter), "connected", G_CALLBACK (connected_cb), web_view);
1175 g_signal_connect (G_OBJECT (greeter), "show-prompt", G_CALLBACK (show_prompt_cb), web_view);1100 g_signal_connect (G_OBJECT (greeter), "show-prompt", G_CALLBACK (show_prompt_cb), web_view);
1176 g_signal_connect (G_OBJECT (greeter), "show-message", G_CALLBACK (show_message_cb), web_view);1101 g_signal_connect (G_OBJECT (greeter), "show-message", G_CALLBACK (show_message_cb), web_view);
1177 g_signal_connect (G_OBJECT (greeter), "show-error", G_CALLBACK (show_message_cb), web_view);1102 g_signal_connect (G_OBJECT (greeter), "show-error", G_CALLBACK (show_message_cb), web_view);
1178 g_signal_connect (G_OBJECT (greeter), "authentication-complete", G_CALLBACK (authentication_complete_cb), web_view);1103 g_signal_connect (G_OBJECT (greeter), "authentication-complete", G_CALLBACK (authentication_complete_cb), web_view);
1179 g_signal_connect (G_OBJECT (greeter), "timed-login", G_CALLBACK (timed_login_cb), web_view);1104 //g_signal_connect (G_OBJECT (greeter), "timed-login", G_CALLBACK (timed_login_cb), web_view);
1180 g_signal_connect (G_OBJECT (greeter), "quit", G_CALLBACK (quit_cb), web_view);1105 g_signal_connect (G_OBJECT (greeter), "quit", G_CALLBACK (quit_cb), web_view);
11811106
1182 ldm_greeter_connect_to_server (greeter);1107 //lightdm_greeter_connect_to_server (greeter);
11831108
1109 webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), g_strdup_printf("file://%s/%s/index.html", THEME_DIR, theme));
1110
1111 gtk_widget_show_all (window);
1112lightdm_greeter_connect_sync (greeter, NULL);
1184 gtk_main ();1113 gtk_main ();
11851114
1186 return 0;1115 return 0;

Subscribers

People subscribed via source and target branches