Merge lp:~elementaryart/lightdm-webkit-greeter/fixes into lp:~lightdm-team/lightdm-webkit-greeter/trunk
- fixes
- Merge into 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 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
LightDM Development Team | Pending | ||
Review via email: mp+75400@code.launchpad.net |
Commit message
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
1 | === modified file 'Makefile.am' |
2 | --- Makefile.am 2011-02-12 00:33:07 +0000 |
3 | +++ Makefile.am 2011-09-24 19:06:23 +0000 |
4 | @@ -18,3 +18,6 @@ |
5 | omf.make \ |
6 | xmldocs.make \ |
7 | po/Makefile.in.in |
8 | + |
9 | +etcdir = /etc/lightdm/ |
10 | +etc_DATA = lightdm-webkit-greeter.conf |
11 | |
12 | === modified file 'configure.ac' |
13 | --- configure.ac 2011-05-20 05:03:42 +0000 |
14 | +++ configure.ac 2011-09-24 19:06:23 +0000 |
15 | @@ -2,6 +2,7 @@ |
16 | |
17 | AC_INIT(lightdm-webkit-greeter, 0.1.0) |
18 | AC_CONFIG_MACRO_DIR(m4) |
19 | +AC_SUBST(THEME_DIR) |
20 | AC_CONFIG_HEADER(config.h) |
21 | AM_INIT_AUTOMAKE |
22 | AM_PROG_CC_C_O |
23 | @@ -15,7 +16,7 @@ |
24 | dnl ########################################################################### |
25 | |
26 | PKG_CHECK_MODULES(GREETER, [ |
27 | - liblightdm-gobject-0 |
28 | + liblightdm-gobject-1 |
29 | gtk+-2.0 |
30 | webkit-1.0 |
31 | dbus-glib-1 |
32 | @@ -24,11 +25,27 @@ |
33 | dnl ########################################################################### |
34 | dnl Configurable values |
35 | dnl ########################################################################### |
36 | -THEME_DIR=`$PKG_CONFIG --define-variable=prefix=$prefix --variable=themedir liblightdm-gobject-0` |
37 | +THEME_DIR="/usr/share/lightdm-webkit/themes/" |
38 | +AC_ARG_WITH(theme-dir, |
39 | + AS_HELP_STRING(--with-theme-dir=<path>, |
40 | + Theme directory to use for webkit themes), |
41 | + if test x$withval != x; then |
42 | + THEME_DIR="$withval" |
43 | + fi |
44 | +) |
45 | AC_SUBST(THEME_DIR) |
46 | +AC_DEFINE_UNQUOTED(THEME_DIR, "$THEME_DIR", Theme Dir) |
47 | |
48 | -GREETER_DIR=`$PKG_CONFIG --define-variable=prefix=$prefix --variable=greeterdir liblightdm-gobject-0` |
49 | -AC_SUBST(GREETER_DIR) |
50 | +CONFIG_DIR="/etc/lightdm/" |
51 | +AC_ARG_WITH(config-dir, |
52 | + AS_HELP_STRING(--with-config-dir=<path>, |
53 | + Configuration directory of lightdm), |
54 | + if test x$withval != x; then |
55 | + CONFIG_DIR="$withval" |
56 | + fi |
57 | +) |
58 | +AC_SUBST(CONFIG_DIR) |
59 | +AC_DEFINE_UNQUOTED(CONFIG_DIR, "$CONFIG_DIR", Config Dir) |
60 | |
61 | dnl ########################################################################### |
62 | dnl Internationalization |
63 | @@ -60,5 +77,5 @@ |
64 | |
65 | prefix: $prefix |
66 | Theme directory: $THEME_DIR |
67 | - Greeter directory: $GREETER_DIR |
68 | + Configuration directory: $CONFIG_DIR |
69 | " |
70 | |
71 | === added file 'lightdm-webkit-greeter.conf' |
72 | --- lightdm-webkit-greeter.conf 1970-01-01 00:00:00 +0000 |
73 | +++ lightdm-webkit-greeter.conf 2011-09-24 19:06:23 +0000 |
74 | @@ -0,0 +1,18 @@ |
75 | +# |
76 | +# background = Background file to use, either an image path or a color (e.g. #772953) |
77 | +# theme-name = GTK+ theme to use |
78 | +# font-name = Font to use |
79 | +# xft-antialias = Whether to antialias Xft fonts (true or false) |
80 | +# xft-dpi = Resolution for Xft in dots per inch (e.g. 96) |
81 | +# xft-hintstyle = What degree of hinting to use (hintnone, hintslight, hintmedium, or hintfull) |
82 | +# xft-rgba = Type of subpixel antialiasing (none, rgb, bgr, vrgb or vbgr) |
83 | +# |
84 | +[greeter] |
85 | +background=/usr/share/backgrounds/warty-final-ubuntu.png |
86 | +theme-name=Ambiance |
87 | +webkit-theme=default |
88 | +font-name=Ubuntu 11 |
89 | +xft-antialias=true |
90 | +xft-dpi=96 |
91 | +xft-hintstyle=slight |
92 | +xft-rgba=rgb |
93 | |
94 | === modified file 'src/Makefile.am' |
95 | --- src/Makefile.am 2011-05-20 05:03:42 +0000 |
96 | +++ src/Makefile.am 2011-09-24 19:06:23 +0000 |
97 | @@ -1,5 +1,5 @@ |
98 | greeter_PROGRAMS = lightdm-webkit-greeter |
99 | -greeterdir = $(GREETER_DIR) |
100 | +greeterdir = $(bindir) |
101 | |
102 | lightdm_webkit_greeter_SOURCES = \ |
103 | lightdm-webkit-greeter.c |
104 | |
105 | === modified file 'src/lightdm-webkit-greeter.c' |
106 | --- src/lightdm-webkit-greeter.c 2011-05-20 05:28:00 +0000 |
107 | +++ src/lightdm-webkit-greeter.c 2011-09-24 19:06:23 +0000 |
108 | @@ -15,25 +15,30 @@ |
109 | #include <JavaScriptCore/JavaScript.h> |
110 | #include <glib/gi18n.h> |
111 | |
112 | -#include <lightdm/greeter.h> |
113 | - |
114 | -static JSClassRef gettext_class, ldm_greeter_class, ldm_user_class, ldm_language_class, ldm_layout_class, ldm_session_class; |
115 | +#include <lightdm.h> |
116 | + |
117 | +#include <../config.h> |
118 | + |
119 | +static JSClassRef gettext_class, lightdm_greeter_class, lightdm_user_class, lightdm_language_class, lightdm_layout_class, lightdm_session_class; |
120 | |
121 | static GtkWidget *web_view, *window; |
122 | |
123 | static void |
124 | -show_prompt_cb (LdmGreeter *greeter, const gchar *text, WebKitWebView *view) |
125 | +show_prompt_cb (LightDMGreeter *greeter, const gchar *text, WebKitWebView *view) |
126 | { |
127 | gchar *command; |
128 | |
129 | + g_debug("Show prompt %s", text); |
130 | + |
131 | command = g_strdup_printf ("show_prompt('%s')", text); // FIXME: Escape text |
132 | - webkit_web_view_execute_script (view, command); |
133 | + webkit_web_view_execute_script (web_view, command); |
134 | g_free (command); |
135 | } |
136 | |
137 | static void |
138 | -show_message_cb (LdmGreeter *greeter, const gchar *text, WebKitWebView *view) |
139 | +show_message_cb (LightDMGreeter *greeter, const gchar *text, WebKitWebView *view) |
140 | { |
141 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
142 | gchar *command; |
143 | |
144 | command = g_strdup_printf ("show_message('%s')", text); // FIXME: Escape text |
145 | @@ -42,13 +47,14 @@ |
146 | } |
147 | |
148 | static void |
149 | -authentication_complete_cb (LdmGreeter *greeter, WebKitWebView *view) |
150 | +authentication_complete_cb (LightDMGreeter *greeter, WebKitWebView *view) |
151 | { |
152 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
153 | webkit_web_view_execute_script (view, "authentication_complete()"); |
154 | } |
155 | |
156 | static void |
157 | -timed_login_cb (LdmGreeter *greeter, const gchar *username, WebKitWebView *view) |
158 | +timed_login_cb (LightDMGreeter *greeter, const gchar *username, WebKitWebView *view) |
159 | { |
160 | gchar *command; |
161 | |
162 | @@ -60,6 +66,7 @@ |
163 | static gboolean |
164 | fade_timer_cb (gpointer data) |
165 | { |
166 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
167 | gdouble opacity; |
168 | |
169 | opacity = gtk_window_get_opacity (GTK_WINDOW (window)); |
170 | @@ -75,7 +82,7 @@ |
171 | } |
172 | |
173 | static void |
174 | -quit_cb (LdmGreeter *greeter, const gchar *username) |
175 | +quit_cb (LightDMGreeter *greeter, const gchar *username) |
176 | { |
177 | /* Fade out the greeter */ |
178 | g_timeout_add (40, (GSourceFunc) fade_timer_cb, NULL); |
179 | @@ -87,10 +94,10 @@ |
180 | JSStringRef propertyName, |
181 | JSValueRef *exception) |
182 | { |
183 | - LdmUser *user = JSObjectGetPrivate (thisObject); |
184 | + LightDMUser *user = JSObjectGetPrivate (thisObject); |
185 | JSStringRef string; |
186 | |
187 | - string = JSStringCreateWithUTF8CString (ldm_user_get_name (user)); |
188 | + string = JSStringCreateWithUTF8CString (lightdm_user_get_name (user)); |
189 | return JSValueMakeString (context, string); |
190 | } |
191 | |
192 | @@ -100,10 +107,10 @@ |
193 | JSStringRef propertyName, |
194 | JSValueRef *exception) |
195 | { |
196 | - LdmUser *user = JSObjectGetPrivate (thisObject); |
197 | + LightDMUser *user = JSObjectGetPrivate (thisObject); |
198 | JSStringRef string; |
199 | |
200 | - string = JSStringCreateWithUTF8CString (ldm_user_get_real_name (user)); |
201 | + string = JSStringCreateWithUTF8CString (lightdm_user_get_real_name (user)); |
202 | return JSValueMakeString (context, string); |
203 | } |
204 | |
205 | @@ -113,10 +120,10 @@ |
206 | JSStringRef propertyName, |
207 | JSValueRef *exception) |
208 | { |
209 | - LdmUser *user = JSObjectGetPrivate (thisObject); |
210 | + LightDMUser *user = JSObjectGetPrivate (thisObject); |
211 | JSStringRef string; |
212 | |
213 | - string = JSStringCreateWithUTF8CString (ldm_user_get_display_name (user)); |
214 | + string = JSStringCreateWithUTF8CString (lightdm_user_get_display_name (user)); |
215 | return JSValueMakeString (context, string); |
216 | } |
217 | |
218 | @@ -126,10 +133,10 @@ |
219 | JSStringRef propertyName, |
220 | JSValueRef *exception) |
221 | { |
222 | - LdmUser *user = JSObjectGetPrivate (thisObject); |
223 | + LightDMUser *user = JSObjectGetPrivate (thisObject); |
224 | JSStringRef string; |
225 | |
226 | - string = JSStringCreateWithUTF8CString (ldm_user_get_image (user)); |
227 | + string = JSStringCreateWithUTF8CString (lightdm_user_get_image (user)); |
228 | return JSValueMakeString (context, string); |
229 | } |
230 | |
231 | @@ -139,8 +146,8 @@ |
232 | JSStringRef propertyName, |
233 | JSValueRef *exception) |
234 | { |
235 | - LdmUser *user = JSObjectGetPrivate (thisObject); |
236 | - const gchar *language = ldm_user_get_language (user); |
237 | + LightDMUser *user = JSObjectGetPrivate (thisObject); |
238 | + const gchar *language = lightdm_user_get_language (user); |
239 | JSStringRef string; |
240 | |
241 | if (!language) |
242 | @@ -156,8 +163,8 @@ |
243 | JSStringRef propertyName, |
244 | JSValueRef *exception) |
245 | { |
246 | - LdmUser *user = JSObjectGetPrivate (thisObject); |
247 | - const gchar *layout = ldm_user_get_layout (user); |
248 | + LightDMUser *user = JSObjectGetPrivate (thisObject); |
249 | + const gchar *layout = lightdm_user_get_layout (user); |
250 | JSStringRef string; |
251 | |
252 | if (!layout) |
253 | @@ -173,8 +180,9 @@ |
254 | JSStringRef propertyName, |
255 | JSValueRef *exception) |
256 | { |
257 | - LdmUser *user = JSObjectGetPrivate (thisObject); |
258 | - const gchar *session = ldm_user_get_session (user); |
259 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
260 | + LightDMUser *user = JSObjectGetPrivate (thisObject); |
261 | + const gchar *session = lightdm_user_get_session (user); |
262 | JSStringRef string; |
263 | |
264 | if (!session) |
265 | @@ -190,8 +198,8 @@ |
266 | JSStringRef propertyName, |
267 | JSValueRef *exception) |
268 | { |
269 | - LdmUser *user = JSObjectGetPrivate (thisObject); |
270 | - return JSValueMakeBoolean (context, ldm_user_get_logged_in (user)); |
271 | + LightDMUser *user = JSObjectGetPrivate (thisObject); |
272 | + return JSValueMakeBoolean (context, lightdm_user_get_logged_in (user)); |
273 | } |
274 | |
275 | static JSValueRef |
276 | @@ -200,10 +208,10 @@ |
277 | JSStringRef propertyName, |
278 | JSValueRef *exception) |
279 | { |
280 | - LdmLanguage *language = JSObjectGetPrivate (thisObject); |
281 | + LightDMLanguage *language = JSObjectGetPrivate (thisObject); |
282 | JSStringRef string; |
283 | |
284 | - string = JSStringCreateWithUTF8CString (ldm_language_get_code (language)); |
285 | + string = JSStringCreateWithUTF8CString (lightdm_language_get_code (language)); |
286 | return JSValueMakeString (context, string); |
287 | } |
288 | |
289 | @@ -213,10 +221,10 @@ |
290 | JSStringRef propertyName, |
291 | JSValueRef *exception) |
292 | { |
293 | - LdmLanguage *language = JSObjectGetPrivate (thisObject); |
294 | + LightDMLanguage *language = JSObjectGetPrivate (thisObject); |
295 | JSStringRef string; |
296 | |
297 | - string = JSStringCreateWithUTF8CString (ldm_language_get_name (language)); |
298 | + string = JSStringCreateWithUTF8CString (lightdm_language_get_name (language)); |
299 | return JSValueMakeString (context, string); |
300 | } |
301 | |
302 | @@ -226,10 +234,10 @@ |
303 | JSStringRef propertyName, |
304 | JSValueRef *exception) |
305 | { |
306 | - LdmLanguage *language = JSObjectGetPrivate (thisObject); |
307 | + LightDMLanguage *language = JSObjectGetPrivate (thisObject); |
308 | JSStringRef string; |
309 | |
310 | - string = JSStringCreateWithUTF8CString (ldm_language_get_territory (language)); |
311 | + string = JSStringCreateWithUTF8CString (lightdm_language_get_territory (language)); |
312 | return JSValueMakeString (context, string); |
313 | } |
314 | |
315 | @@ -239,10 +247,10 @@ |
316 | JSStringRef propertyName, |
317 | JSValueRef *exception) |
318 | { |
319 | - LdmLayout *layout = JSObjectGetPrivate (thisObject); |
320 | + LightDMLayout *layout = JSObjectGetPrivate (thisObject); |
321 | JSStringRef string; |
322 | |
323 | - string = JSStringCreateWithUTF8CString (ldm_layout_get_name (layout)); |
324 | + string = JSStringCreateWithUTF8CString (lightdm_layout_get_name (layout)); |
325 | return JSValueMakeString (context, string); |
326 | } |
327 | |
328 | @@ -252,10 +260,11 @@ |
329 | JSStringRef propertyName, |
330 | JSValueRef *exception) |
331 | { |
332 | - LdmLayout *layout = JSObjectGetPrivate (thisObject); |
333 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
334 | + LightDMLayout *layout = JSObjectGetPrivate (thisObject); |
335 | JSStringRef string; |
336 | |
337 | - string = JSStringCreateWithUTF8CString (ldm_layout_get_short_description (layout)); |
338 | + string = JSStringCreateWithUTF8CString (lightdm_layout_get_short_description (layout)); |
339 | return JSValueMakeString (context, string); |
340 | } |
341 | |
342 | @@ -265,10 +274,11 @@ |
343 | JSStringRef propertyName, |
344 | JSValueRef *exception) |
345 | { |
346 | - LdmLayout *layout = JSObjectGetPrivate (thisObject); |
347 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
348 | + LightDMLayout *layout = JSObjectGetPrivate (thisObject); |
349 | JSStringRef string; |
350 | |
351 | - string = JSStringCreateWithUTF8CString (ldm_layout_get_description (layout)); |
352 | + string = JSStringCreateWithUTF8CString (lightdm_layout_get_description (layout)); |
353 | return JSValueMakeString (context, string); |
354 | } |
355 | |
356 | @@ -278,10 +288,10 @@ |
357 | JSStringRef propertyName, |
358 | JSValueRef *exception) |
359 | { |
360 | - LdmSession *session = JSObjectGetPrivate (thisObject); |
361 | + LightDMSession *session = JSObjectGetPrivate (thisObject); |
362 | JSStringRef string; |
363 | |
364 | - string = JSStringCreateWithUTF8CString (ldm_session_get_key (session)); |
365 | + string = JSStringCreateWithUTF8CString (lightdm_session_get_key (session)); |
366 | return JSValueMakeString (context, string); |
367 | |
368 | } |
369 | @@ -291,10 +301,10 @@ |
370 | JSStringRef propertyName, |
371 | JSValueRef *exception) |
372 | { |
373 | - LdmSession *session = JSObjectGetPrivate (thisObject); |
374 | + LightDMSession *session = JSObjectGetPrivate (thisObject); |
375 | JSStringRef string; |
376 | |
377 | - string = JSStringCreateWithUTF8CString (ldm_session_get_name (session)); |
378 | + string = JSStringCreateWithUTF8CString (lightdm_session_get_name (session)); |
379 | return JSValueMakeString (context, string); |
380 | } |
381 | |
382 | @@ -304,10 +314,10 @@ |
383 | JSStringRef propertyName, |
384 | JSValueRef *exception) |
385 | { |
386 | - LdmSession *session = JSObjectGetPrivate (thisObject); |
387 | + LightDMSession *session = JSObjectGetPrivate (thisObject); |
388 | JSStringRef string; |
389 | |
390 | - string = JSStringCreateWithUTF8CString (ldm_session_get_comment (session)); |
391 | + string = JSStringCreateWithUTF8CString (lightdm_session_get_comment (session)); |
392 | return JSValueMakeString (context, string); |
393 | } |
394 | |
395 | @@ -317,10 +327,10 @@ |
396 | JSStringRef propertyName, |
397 | JSValueRef *exception) |
398 | { |
399 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
400 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
401 | JSStringRef string; |
402 | |
403 | - string = JSStringCreateWithUTF8CString (ldm_greeter_get_hostname (greeter)); |
404 | + string = JSStringCreateWithUTF8CString (lightdm_get_hostname ()); |
405 | |
406 | return JSValueMakeString (context, string); |
407 | } |
408 | @@ -331,10 +341,10 @@ |
409 | JSStringRef propertyName, |
410 | JSValueRef *exception) |
411 | { |
412 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
413 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
414 | gint num_users; |
415 | |
416 | - num_users = ldm_greeter_get_num_users (greeter); |
417 | + num_users = g_list_length(lightdm_user_list_get_users (lightdm_user_list_get_instance())); |
418 | return JSValueMakeNumber (context, num_users); |
419 | } |
420 | |
421 | @@ -344,20 +354,20 @@ |
422 | JSStringRef propertyName, |
423 | JSValueRef *exception) |
424 | { |
425 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
426 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
427 | JSObjectRef array; |
428 | const GList *users, *link; |
429 | guint i, n_users = 0; |
430 | JSValueRef *args; |
431 | |
432 | - users = ldm_greeter_get_users (greeter); |
433 | + users = lightdm_user_list_get_users( lightdm_user_list_get_instance() ); |
434 | n_users = g_list_length ((GList *)users); |
435 | args = g_malloc (sizeof (JSValueRef) * (n_users + 1)); |
436 | for (i = 0, link = users; link; i++, link = link->next) |
437 | { |
438 | - LdmUser *user = link->data; |
439 | + LightDMUser *user = link->data; |
440 | g_object_ref (user); |
441 | - args[i] = JSObjectMake (context, ldm_user_class, user); |
442 | + args[i] = JSObjectMake (context, lightdm_user_class, user); |
443 | } |
444 | |
445 | array = JSObjectMakeArray (context, n_users, args, NULL); |
446 | @@ -371,20 +381,19 @@ |
447 | JSStringRef propertyName, |
448 | JSValueRef *exception) |
449 | { |
450 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
451 | JSObjectRef array; |
452 | const GList *languages, *link; |
453 | guint i, n_languages = 0; |
454 | JSValueRef *args; |
455 | |
456 | - languages = ldm_greeter_get_languages (greeter); |
457 | + languages = lightdm_get_languages (); |
458 | n_languages = g_list_length ((GList *)languages); |
459 | args = g_malloc (sizeof (JSValueRef) * (n_languages + 1)); |
460 | for (i = 0, link = languages; link; i++, link = link->next) |
461 | { |
462 | - LdmLanguage *language = link->data; |
463 | + LightDMLanguage *language = link->data; |
464 | g_object_ref (language); |
465 | - args[i] = JSObjectMake (context, ldm_language_class, language); |
466 | + args[i] = JSObjectMake (context, lightdm_language_class, language); |
467 | } |
468 | |
469 | array = JSObjectMakeArray (context, n_languages, args, NULL); |
470 | @@ -398,10 +407,10 @@ |
471 | JSStringRef propertyName, |
472 | JSValueRef *exception) |
473 | { |
474 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
475 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
476 | JSStringRef string; |
477 | |
478 | - string = JSStringCreateWithUTF8CString (ldm_greeter_get_default_language (greeter)); |
479 | + string = JSStringCreateWithUTF8CString (lightdm_language_get_name((LightDMLanguage *)lightdm_get_language ())); |
480 | |
481 | return JSValueMakeString (context, string); |
482 | } |
483 | @@ -412,10 +421,9 @@ |
484 | JSStringRef propertyName, |
485 | JSValueRef *exception) |
486 | { |
487 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
488 | JSStringRef string; |
489 | |
490 | - string = JSStringCreateWithUTF8CString (ldm_greeter_get_default_layout (greeter)); |
491 | + string = JSStringCreateWithUTF8CString (lightdm_layout_get_name(lightdm_get_layout ())); |
492 | |
493 | return JSValueMakeString (context, string); |
494 | } |
495 | @@ -426,20 +434,19 @@ |
496 | JSStringRef propertyName, |
497 | JSValueRef *exception) |
498 | { |
499 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
500 | JSObjectRef array; |
501 | const GList *layouts, *link; |
502 | guint i, n_layouts = 0; |
503 | JSValueRef *args; |
504 | |
505 | - layouts = ldm_greeter_get_layouts (greeter); |
506 | + layouts = lightdm_get_layouts (); |
507 | n_layouts = g_list_length ((GList *)layouts); |
508 | args = g_malloc (sizeof (JSValueRef) * (n_layouts + 1)); |
509 | for (i = 0, link = layouts; link; i++, link = link->next) |
510 | { |
511 | - LdmLayout *layout = link->data; |
512 | + LightDMLayout *layout = link->data; |
513 | g_object_ref (layout); |
514 | - args[i] = JSObjectMake (context, ldm_layout_class, layout); |
515 | + args[i] = JSObjectMake (context, lightdm_layout_class, layout); |
516 | } |
517 | |
518 | array = JSObjectMakeArray (context, n_layouts, args, NULL); |
519 | @@ -453,10 +460,10 @@ |
520 | JSStringRef propertyName, |
521 | JSValueRef *exception) |
522 | { |
523 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
524 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
525 | JSStringRef string; |
526 | |
527 | - string = JSStringCreateWithUTF8CString (ldm_greeter_get_layout (greeter)); |
528 | + string = JSStringCreateWithUTF8CString (lightdm_layout_get_name(lightdm_get_layout ())); |
529 | |
530 | return JSValueMakeString (context, string); |
531 | } |
532 | @@ -468,7 +475,6 @@ |
533 | JSValueRef value, |
534 | JSValueRef *exception) |
535 | { |
536 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
537 | JSStringRef layout_arg; |
538 | char layout[1024]; |
539 | |
540 | @@ -480,7 +486,7 @@ |
541 | JSStringGetUTF8CString (layout_arg, layout, 1024); |
542 | JSStringRelease (layout_arg); |
543 | |
544 | - ldm_greeter_set_layout (greeter, layout); |
545 | + //lightdm_set_layout (layout); |
546 | |
547 | return true; |
548 | } |
549 | @@ -491,20 +497,19 @@ |
550 | JSStringRef propertyName, |
551 | JSValueRef *exception) |
552 | { |
553 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
554 | JSObjectRef array; |
555 | const GList *sessions, *link; |
556 | guint i, n_sessions = 0; |
557 | JSValueRef *args; |
558 | |
559 | - sessions = ldm_greeter_get_sessions (greeter); |
560 | + sessions = lightdm_get_sessions (); |
561 | n_sessions = g_list_length ((GList *)sessions); |
562 | args = g_malloc (sizeof (JSValueRef) * (n_sessions + 1)); |
563 | for (i = 0, link = sessions; link; i++, link = link->next) |
564 | { |
565 | - LdmSession *session = link->data; |
566 | + LightDMSession *session = link->data; |
567 | g_object_ref (session); |
568 | - args[i] = JSObjectMake (context, ldm_session_class, session); |
569 | + args[i] = JSObjectMake (context, lightdm_session_class, session); |
570 | } |
571 | |
572 | array = JSObjectMakeArray (context, n_sessions, args, NULL); |
573 | @@ -518,10 +523,10 @@ |
574 | JSStringRef propertyName, |
575 | JSValueRef *exception) |
576 | { |
577 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
578 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
579 | JSStringRef string; |
580 | |
581 | - string = JSStringCreateWithUTF8CString (ldm_greeter_get_default_session (greeter)); |
582 | + string = JSStringCreateWithUTF8CString (lightdm_greeter_get_default_session_hint (greeter)); |
583 | |
584 | return JSValueMakeString (context, string); |
585 | } |
586 | @@ -532,10 +537,10 @@ |
587 | JSStringRef propertyName, |
588 | JSValueRef *exception) |
589 | { |
590 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
591 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
592 | JSStringRef string; |
593 | |
594 | - string = JSStringCreateWithUTF8CString (ldm_greeter_get_timed_login_user (greeter)); |
595 | + string = JSStringCreateWithUTF8CString (lightdm_greeter_get_autologin_user_hint (greeter)); |
596 | |
597 | return JSValueMakeString (context, string); |
598 | } |
599 | @@ -546,91 +551,13 @@ |
600 | JSStringRef propertyName, |
601 | JSValueRef *exception) |
602 | { |
603 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
604 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
605 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
606 | gint delay; |
607 | |
608 | - delay = ldm_greeter_get_timed_login_delay (greeter); |
609 | + delay = lightdm_greeter_get_autologin_timeout_hint (greeter); |
610 | return JSValueMakeNumber (context, delay); |
611 | } |
612 | - |
613 | -static JSValueRef |
614 | -get_string_property_cb (JSContextRef context, |
615 | - JSObjectRef function, |
616 | - JSObjectRef thisObject, |
617 | - size_t argumentCount, |
618 | - const JSValueRef arguments[], |
619 | - JSValueRef *exception) |
620 | -{ |
621 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
622 | - JSStringRef name_arg; |
623 | - char name[1024]; |
624 | - gchar *value; |
625 | - JSStringRef string; |
626 | - |
627 | - // FIXME: Throw exception |
628 | - if (argumentCount != 1) |
629 | - return JSValueMakeNull (context); |
630 | - |
631 | - name_arg = JSValueToStringCopy (context, arguments[0], NULL); |
632 | - JSStringGetUTF8CString (name_arg, name, 1024); |
633 | - JSStringRelease (name_arg); |
634 | - |
635 | - value = ldm_greeter_get_string_property (greeter, name); |
636 | - |
637 | - if (!value) |
638 | - return JSValueMakeNull (context); |
639 | - |
640 | - string = JSStringCreateWithUTF8CString (value); |
641 | - g_free (value); |
642 | - return JSValueMakeString (context, string); |
643 | -} |
644 | - |
645 | -static JSValueRef |
646 | -get_integer_property_cb (JSContextRef context, |
647 | - JSObjectRef function, |
648 | - JSObjectRef thisObject, |
649 | - size_t argumentCount, |
650 | - const JSValueRef arguments[], |
651 | - JSValueRef *exception) |
652 | -{ |
653 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
654 | - JSStringRef name_arg; |
655 | - char name[1024]; |
656 | - |
657 | - // FIXME: Throw exception |
658 | - if (argumentCount != 1) |
659 | - return JSValueMakeNull (context); |
660 | - |
661 | - name_arg = JSValueToStringCopy (context, arguments[0], NULL); |
662 | - JSStringGetUTF8CString (name_arg, name, 1024); |
663 | - JSStringRelease (name_arg); |
664 | - |
665 | - return JSValueMakeNumber (context, ldm_greeter_get_integer_property (greeter, name)); |
666 | -} |
667 | - |
668 | -static JSValueRef |
669 | -get_boolean_property_cb (JSContextRef context, |
670 | - JSObjectRef function, |
671 | - JSObjectRef thisObject, |
672 | - size_t argumentCount, |
673 | - const JSValueRef arguments[], |
674 | - JSValueRef *exception) |
675 | -{ |
676 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
677 | - JSStringRef name_arg; |
678 | - char name[1024]; |
679 | - |
680 | - // FIXME: Throw exception |
681 | - if (argumentCount != 1) |
682 | - return JSValueMakeNull (context); |
683 | - |
684 | - name_arg = JSValueToStringCopy (context, arguments[0], NULL); |
685 | - JSStringGetUTF8CString (name_arg, name, 1024); |
686 | - JSStringRelease (name_arg); |
687 | - |
688 | - return JSValueMakeBoolean (context, ldm_greeter_get_boolean_property (greeter, name)); |
689 | -} |
690 | - |
691 | static JSValueRef |
692 | cancel_timed_login_cb (JSContextRef context, |
693 | JSObjectRef function, |
694 | @@ -639,13 +566,14 @@ |
695 | const JSValueRef arguments[], |
696 | JSValueRef *exception) |
697 | { |
698 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
699 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
700 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
701 | |
702 | // FIXME: Throw exception |
703 | if (argumentCount != 0) |
704 | return JSValueMakeNull (context); |
705 | |
706 | - ldm_greeter_cancel_timed_login (greeter); |
707 | + lightdm_greeter_cancel_autologin (greeter); |
708 | return JSValueMakeNull (context); |
709 | } |
710 | |
711 | @@ -657,7 +585,8 @@ |
712 | const JSValueRef arguments[], |
713 | JSValueRef *exception) |
714 | { |
715 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
716 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
717 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
718 | JSStringRef name_arg; |
719 | char name[1024]; |
720 | |
721 | @@ -669,7 +598,7 @@ |
722 | JSStringGetUTF8CString (name_arg, name, 1024); |
723 | JSStringRelease (name_arg); |
724 | |
725 | - ldm_greeter_start_authentication (greeter, name); |
726 | + lightdm_greeter_authenticate (greeter, name); |
727 | return JSValueMakeNull (context); |
728 | } |
729 | |
730 | @@ -681,11 +610,13 @@ |
731 | const JSValueRef arguments[], |
732 | JSValueRef *exception) |
733 | { |
734 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
735 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
736 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
737 | JSStringRef secret_arg; |
738 | char secret[1024]; |
739 | |
740 | // FIXME: Throw exception |
741 | + g_debug("%d %d %d\n", argumentCount, argumentCount == 1, JSValueGetType (context, arguments[0])); |
742 | if (!(argumentCount == 1 && JSValueGetType (context, arguments[0]) == kJSTypeString)) |
743 | return JSValueMakeNull (context); |
744 | |
745 | @@ -693,7 +624,9 @@ |
746 | JSStringGetUTF8CString (secret_arg, secret, 1024); |
747 | JSStringRelease (secret_arg); |
748 | |
749 | - ldm_greeter_provide_secret (greeter, secret); |
750 | + g_debug(secret); |
751 | + // TODO |
752 | + lightdm_greeter_respond (greeter, secret); |
753 | return JSValueMakeNull (context); |
754 | } |
755 | |
756 | @@ -705,13 +638,13 @@ |
757 | const JSValueRef arguments[], |
758 | JSValueRef *exception) |
759 | { |
760 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
761 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
762 | |
763 | // FIXME: Throw exception |
764 | if (argumentCount != 0) |
765 | return JSValueMakeNull (context); |
766 | |
767 | - ldm_greeter_cancel_authentication (greeter); |
768 | + lightdm_greeter_cancel_authentication (greeter); |
769 | return JSValueMakeNull (context); |
770 | } |
771 | |
772 | @@ -721,8 +654,8 @@ |
773 | JSStringRef propertyName, |
774 | JSValueRef *exception) |
775 | { |
776 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
777 | - return JSValueMakeString (context, JSStringCreateWithUTF8CString (ldm_greeter_get_authentication_user (greeter))); |
778 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
779 | + return JSValueMakeString (context, JSStringCreateWithUTF8CString (lightdm_greeter_get_authentication_user (greeter))); |
780 | } |
781 | |
782 | static JSValueRef |
783 | @@ -731,8 +664,8 @@ |
784 | JSStringRef propertyName, |
785 | JSValueRef *exception) |
786 | { |
787 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
788 | - return JSValueMakeBoolean (context, ldm_greeter_get_is_authenticated (greeter)); |
789 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
790 | + return JSValueMakeBoolean (context, lightdm_greeter_get_is_authenticated (greeter)); |
791 | } |
792 | |
793 | static JSValueRef |
794 | @@ -741,8 +674,7 @@ |
795 | JSStringRef propertyName, |
796 | JSValueRef *exception) |
797 | { |
798 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
799 | - return JSValueMakeBoolean (context, ldm_greeter_get_can_suspend (greeter)); |
800 | + return JSValueMakeBoolean (context, lightdm_get_can_suspend ()); |
801 | } |
802 | |
803 | static JSValueRef |
804 | @@ -753,13 +685,12 @@ |
805 | const JSValueRef arguments[], |
806 | JSValueRef *exception) |
807 | { |
808 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
809 | - |
810 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
811 | // FIXME: Throw exception |
812 | if (argumentCount != 0) |
813 | return JSValueMakeNull (context); |
814 | |
815 | - ldm_greeter_suspend (greeter); |
816 | + lightdm_suspend(NULL); |
817 | return JSValueMakeNull (context); |
818 | } |
819 | |
820 | @@ -769,8 +700,8 @@ |
821 | JSStringRef propertyName, |
822 | JSValueRef *exception) |
823 | { |
824 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
825 | - return JSValueMakeBoolean (context, ldm_greeter_get_can_hibernate (greeter)); |
826 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
827 | + return JSValueMakeBoolean (context, lightdm_get_can_hibernate ()); |
828 | } |
829 | |
830 | static JSValueRef |
831 | @@ -781,13 +712,12 @@ |
832 | const JSValueRef arguments[], |
833 | JSValueRef *exception) |
834 | { |
835 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
836 | - |
837 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
838 | // FIXME: Throw exception |
839 | if (argumentCount != 0) |
840 | return JSValueMakeNull (context); |
841 | |
842 | - ldm_greeter_hibernate (greeter); |
843 | + lightdm_hibernate (NULL); |
844 | return JSValueMakeNull (context); |
845 | } |
846 | |
847 | @@ -797,8 +727,8 @@ |
848 | JSStringRef propertyName, |
849 | JSValueRef *exception) |
850 | { |
851 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
852 | - return JSValueMakeBoolean (context, ldm_greeter_get_can_restart (greeter)); |
853 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
854 | + return JSValueMakeBoolean (context, lightdm_get_can_restart ()); |
855 | } |
856 | |
857 | static JSValueRef |
858 | @@ -809,13 +739,11 @@ |
859 | const JSValueRef arguments[], |
860 | JSValueRef *exception) |
861 | { |
862 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
863 | - |
864 | // FIXME: Throw exception |
865 | if (argumentCount != 0) |
866 | return JSValueMakeNull (context); |
867 | |
868 | - ldm_greeter_restart (greeter); |
869 | + lightdm_restart (NULL); |
870 | return JSValueMakeNull (context); |
871 | } |
872 | |
873 | @@ -825,8 +753,7 @@ |
874 | JSStringRef propertyName, |
875 | JSValueRef *exception) |
876 | { |
877 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
878 | - return JSValueMakeBoolean (context, ldm_greeter_get_can_shutdown (greeter)); |
879 | + return JSValueMakeBoolean (context, lightdm_get_can_shutdown ()); |
880 | } |
881 | |
882 | static JSValueRef |
883 | @@ -837,13 +764,11 @@ |
884 | const JSValueRef arguments[], |
885 | JSValueRef *exception) |
886 | { |
887 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
888 | - |
889 | // FIXME: Throw exception |
890 | if (argumentCount != 0) |
891 | return JSValueMakeNull (context); |
892 | |
893 | - ldm_greeter_shutdown (greeter); |
894 | + lightdm_shutdown (NULL); |
895 | return JSValueMakeNull (context); |
896 | } |
897 | |
898 | @@ -855,13 +780,12 @@ |
899 | const JSValueRef arguments[], |
900 | JSValueRef *exception) |
901 | { |
902 | - LdmGreeter *greeter = JSObjectGetPrivate (thisObject); |
903 | + g_debug("%s", __FUNCTION__); |
904 | + LightDMGreeter *greeter = JSObjectGetPrivate (thisObject); |
905 | JSStringRef arg; |
906 | char username[1024], *session = NULL, *language = NULL; |
907 | |
908 | // FIXME: Throw exception |
909 | - if (argumentCount < 1 || argumentCount > 3) |
910 | - return JSValueMakeNull (context); |
911 | |
912 | arg = JSValueToStringCopy (context, arguments[0], NULL); |
913 | JSStringGetUTF8CString (arg, username, 1024); |
914 | @@ -883,7 +807,7 @@ |
915 | JSStringRelease (arg); |
916 | } |
917 | |
918 | - ldm_greeter_login (greeter, username, session, language); |
919 | + lightdm_greeter_start_session_sync (greeter, session, NULL); |
920 | g_free (session); |
921 | g_free (language); |
922 | |
923 | @@ -898,6 +822,7 @@ |
924 | const JSValueRef arguments[], |
925 | JSValueRef *exception) |
926 | { |
927 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
928 | JSStringRef string_arg, result; |
929 | char string[1024]; |
930 | |
931 | @@ -921,6 +846,7 @@ |
932 | const JSValueRef arguments[], |
933 | JSValueRef *exception) |
934 | { |
935 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
936 | JSStringRef string_arg, plural_string_arg, result; |
937 | char string[1024], plural_string[1024]; |
938 | unsigned int n; |
939 | @@ -943,7 +869,7 @@ |
940 | return JSValueMakeString (context, result); |
941 | } |
942 | |
943 | -static const JSStaticValue ldm_user_values[] = |
944 | +static const JSStaticValue lightdm_user_values[] = |
945 | { |
946 | { "name", get_user_name_cb, NULL, kJSPropertyAttributeReadOnly }, |
947 | { "real_name", get_user_real_name_cb, NULL, kJSPropertyAttributeReadOnly }, |
948 | @@ -956,7 +882,7 @@ |
949 | { NULL, NULL, NULL, 0 } |
950 | }; |
951 | |
952 | -static const JSStaticValue ldm_language_values[] = |
953 | +static const JSStaticValue lightdm_language_values[] = |
954 | { |
955 | { "code", get_language_code_cb, NULL, kJSPropertyAttributeReadOnly }, |
956 | { "name", get_language_name_cb, NULL, kJSPropertyAttributeReadOnly }, |
957 | @@ -964,7 +890,7 @@ |
958 | { NULL, NULL, NULL, 0 } |
959 | }; |
960 | |
961 | -static const JSStaticValue ldm_layout_values[] = |
962 | +static const JSStaticValue lightdm_layout_values[] = |
963 | { |
964 | { "name", get_layout_name_cb, NULL, kJSPropertyAttributeReadOnly }, |
965 | { "short_description", get_layout_short_description_cb, NULL, kJSPropertyAttributeReadOnly }, |
966 | @@ -972,7 +898,7 @@ |
967 | { NULL, NULL, NULL, 0 } |
968 | }; |
969 | |
970 | -static const JSStaticValue ldm_session_values[] = |
971 | +static const JSStaticValue lightdm_session_values[] = |
972 | { |
973 | { "key", get_session_key_cb, NULL, kJSPropertyAttributeReadOnly }, |
974 | { "name", get_session_name_cb, NULL, kJSPropertyAttributeReadOnly }, |
975 | @@ -980,7 +906,7 @@ |
976 | { NULL, NULL, NULL, 0 } |
977 | }; |
978 | |
979 | -static const JSStaticValue ldm_greeter_values[] = |
980 | +static const JSStaticValue lightdm_greeter_values[] = |
981 | { |
982 | { "hostname", get_hostname_cb, NULL, kJSPropertyAttributeReadOnly }, |
983 | { "users", get_users_cb, NULL, kJSPropertyAttributeReadOnly }, |
984 | @@ -1003,11 +929,8 @@ |
985 | { NULL, NULL, NULL, 0 } |
986 | }; |
987 | |
988 | -static const JSStaticFunction ldm_greeter_functions[] = |
989 | +static const JSStaticFunction lightdm_greeter_functions[] = |
990 | { |
991 | - { "get_string_property", get_string_property_cb, kJSPropertyAttributeReadOnly }, |
992 | - { "get_integer_property", get_integer_property_cb, kJSPropertyAttributeReadOnly }, |
993 | - { "get_boolean_property", get_boolean_property_cb, kJSPropertyAttributeReadOnly }, |
994 | { "cancel_timed_login", cancel_timed_login_cb, kJSPropertyAttributeReadOnly }, |
995 | { "start_authentication", start_authentication_cb, kJSPropertyAttributeReadOnly }, |
996 | { "provide_secret", provide_secret_cb, kJSPropertyAttributeReadOnly }, |
997 | @@ -1027,50 +950,50 @@ |
998 | { NULL, NULL, 0 } |
999 | }; |
1000 | |
1001 | -static const JSClassDefinition ldm_user_definition = |
1002 | -{ |
1003 | - 0, /* Version */ |
1004 | - kJSClassAttributeNone, /* Attributes */ |
1005 | - "LdmUser", /* Class name */ |
1006 | - NULL, /* Parent class */ |
1007 | - ldm_user_values, /* Static values */ |
1008 | -}; |
1009 | - |
1010 | -static const JSClassDefinition ldm_language_definition = |
1011 | -{ |
1012 | - 0, /* Version */ |
1013 | - kJSClassAttributeNone, /* Attributes */ |
1014 | - "LdmLanguage", /* Class name */ |
1015 | - NULL, /* Parent class */ |
1016 | - ldm_language_values, /* Static values */ |
1017 | -}; |
1018 | - |
1019 | -static const JSClassDefinition ldm_layout_definition = |
1020 | -{ |
1021 | - 0, /* Version */ |
1022 | - kJSClassAttributeNone, /* Attributes */ |
1023 | - "LdmLayout", /* Class name */ |
1024 | - NULL, /* Parent class */ |
1025 | - ldm_layout_values, /* Static values */ |
1026 | -}; |
1027 | - |
1028 | -static const JSClassDefinition ldm_session_definition = |
1029 | -{ |
1030 | - 0, /* Version */ |
1031 | - kJSClassAttributeNone, /* Attributes */ |
1032 | - "LdmSession", /* Class name */ |
1033 | - NULL, /* Parent class */ |
1034 | - ldm_session_values, /* Static values */ |
1035 | -}; |
1036 | - |
1037 | -static const JSClassDefinition ldm_greeter_definition = |
1038 | -{ |
1039 | - 0, /* Version */ |
1040 | - kJSClassAttributeNone, /* Attributes */ |
1041 | - "LdmGreeter", /* Class name */ |
1042 | - NULL, /* Parent class */ |
1043 | - ldm_greeter_values, /* Static values */ |
1044 | - ldm_greeter_functions, /* Static functions */ |
1045 | +static const JSClassDefinition lightdm_user_definition = |
1046 | +{ |
1047 | + 0, /* Version */ |
1048 | + kJSClassAttributeNone, /* Attributes */ |
1049 | + "LightDMUser", /* Class name */ |
1050 | + NULL, /* Parent class */ |
1051 | + lightdm_user_values, /* Static values */ |
1052 | +}; |
1053 | + |
1054 | +static const JSClassDefinition lightdm_language_definition = |
1055 | +{ |
1056 | + 0, /* Version */ |
1057 | + kJSClassAttributeNone, /* Attributes */ |
1058 | + "LightDMLanguage", /* Class name */ |
1059 | + NULL, /* Parent class */ |
1060 | + lightdm_language_values, /* Static values */ |
1061 | +}; |
1062 | + |
1063 | +static const JSClassDefinition lightdm_layout_definition = |
1064 | +{ |
1065 | + 0, /* Version */ |
1066 | + kJSClassAttributeNone, /* Attributes */ |
1067 | + "LightDMLayout", /* Class name */ |
1068 | + NULL, /* Parent class */ |
1069 | + lightdm_layout_values, /* Static values */ |
1070 | +}; |
1071 | + |
1072 | +static const JSClassDefinition lightdm_session_definition = |
1073 | +{ |
1074 | + 0, /* Version */ |
1075 | + kJSClassAttributeNone, /* Attributes */ |
1076 | + "LightDMSession", /* Class name */ |
1077 | + NULL, /* Parent class */ |
1078 | + lightdm_session_values, /* Static values */ |
1079 | +}; |
1080 | + |
1081 | +static const JSClassDefinition lightdm_greeter_definition = |
1082 | +{ |
1083 | + 0, /* Version */ |
1084 | + kJSClassAttributeNone, /* Attributes */ |
1085 | + "LightDMGreeter", /* Class name */ |
1086 | + NULL, /* Parent class */ |
1087 | + lightdm_greeter_values, /* Static values */ |
1088 | + lightdm_greeter_functions, /* Static functions */ |
1089 | }; |
1090 | |
1091 | static const JSClassDefinition gettext_definition = |
1092 | @@ -1088,16 +1011,17 @@ |
1093 | WebKitWebFrame *frame, |
1094 | JSGlobalContextRef context, |
1095 | JSObjectRef window_object, |
1096 | - LdmGreeter *greeter) |
1097 | + LightDMGreeter *greeter) |
1098 | { |
1099 | - JSObjectRef gettext_object, ldm_greeter_object; |
1100 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
1101 | + JSObjectRef gettext_object, lightdm_greeter_object; |
1102 | |
1103 | gettext_class = JSClassCreate (&gettext_definition); |
1104 | - ldm_greeter_class = JSClassCreate (&ldm_greeter_definition); |
1105 | - ldm_user_class = JSClassCreate (&ldm_user_definition); |
1106 | - ldm_language_class = JSClassCreate (&ldm_language_definition); |
1107 | - ldm_layout_class = JSClassCreate (&ldm_layout_definition); |
1108 | - ldm_session_class = JSClassCreate (&ldm_session_definition); |
1109 | + lightdm_greeter_class = JSClassCreate (&lightdm_greeter_definition); |
1110 | + lightdm_user_class = JSClassCreate (&lightdm_user_definition); |
1111 | + lightdm_language_class = JSClassCreate (&lightdm_language_definition); |
1112 | + lightdm_layout_class = JSClassCreate (&lightdm_layout_definition); |
1113 | + lightdm_session_class = JSClassCreate (&lightdm_session_definition); |
1114 | |
1115 | gettext_object = JSObjectMake (context, gettext_class, NULL); |
1116 | JSObjectSetProperty (context, |
1117 | @@ -1105,11 +1029,11 @@ |
1118 | JSStringCreateWithUTF8CString ("gettext"), |
1119 | gettext_object, kJSPropertyAttributeNone, NULL); |
1120 | |
1121 | - ldm_greeter_object = JSObjectMake (context, ldm_greeter_class, greeter); |
1122 | + lightdm_greeter_object = JSObjectMake (context, lightdm_greeter_class, greeter); |
1123 | JSObjectSetProperty (context, |
1124 | JSContextGetGlobalObject (context), |
1125 | JSStringCreateWithUTF8CString ("lightdm"), |
1126 | - ldm_greeter_object, kJSPropertyAttributeNone, NULL); |
1127 | + lightdm_greeter_object, kJSPropertyAttributeNone, NULL); |
1128 | } |
1129 | |
1130 | static void |
1131 | @@ -1119,23 +1043,23 @@ |
1132 | } |
1133 | |
1134 | static void |
1135 | -connected_cb (LdmGreeter *greeter) |
1136 | +connected_cb (LightDMGreeter *greeter) |
1137 | { |
1138 | + g_debug("%s %d", __FUNCTION__, __LINE__); |
1139 | gchar *url; |
1140 | |
1141 | - url = ldm_greeter_get_string_property (greeter, "url"); |
1142 | + url = "index.html"; |
1143 | if (url) |
1144 | { |
1145 | gchar *theme_dir, *rel_url; |
1146 | |
1147 | - theme_dir = g_path_get_dirname (ldm_greeter_get_theme (greeter)); |
1148 | + theme_dir = g_path_get_dirname ("/usr/share/lightdm/elementary/"); |
1149 | rel_url = url; |
1150 | url = g_strdup_printf ("file://%s/%s", theme_dir, rel_url); |
1151 | g_free (theme_dir); |
1152 | g_free (rel_url); |
1153 | |
1154 | g_debug ("Showing URL %s", url); |
1155 | - webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), url); |
1156 | g_free (url); |
1157 | } |
1158 | else |
1159 | @@ -1147,40 +1071,45 @@ |
1160 | int |
1161 | main (int argc, char **argv) |
1162 | { |
1163 | - LdmGreeter *greeter; |
1164 | - GdkDisplay *display; |
1165 | + LightDMGreeter *greeter; |
1166 | GdkScreen *screen; |
1167 | - gint screen_width, screen_height; |
1168 | + GdkRectangle geometry; |
1169 | |
1170 | signal (SIGTERM, sigterm_cb); |
1171 | |
1172 | gtk_init (&argc, &argv); |
1173 | - |
1174 | - greeter = ldm_greeter_new (); |
1175 | - |
1176 | - display = gdk_display_get_default (); |
1177 | - screen = gdk_display_get_default_screen (display); |
1178 | - screen_width = gdk_screen_get_width (screen); |
1179 | - screen_height = gdk_screen_get_height (screen); |
1180 | + gdk_window_set_cursor (gdk_get_default_root_window (), gdk_cursor_new (GDK_LEFT_PTR)); |
1181 | + greeter = lightdm_greeter_new (); |
1182 | + |
1183 | + /* settings */ |
1184 | + GKeyFile* keyfile = g_key_file_new(); |
1185 | + g_key_file_load_from_file(keyfile, "/etc/lightdm/lightdm-webkit-greeter.conf", G_KEY_FILE_NONE, NULL); |
1186 | + gchar* theme = g_key_file_get_string(keyfile, "greeter", "webkit-theme", NULL); |
1187 | |
1188 | window = gtk_window_new (GTK_WINDOW_TOPLEVEL); |
1189 | - gtk_window_set_default_size (GTK_WINDOW (window), screen_width, screen_height); |
1190 | - gtk_window_fullscreen (GTK_WINDOW (window)); |
1191 | + screen = gtk_window_get_screen (window); |
1192 | + gdk_screen_get_monitor_geometry (screen, gdk_screen_get_primary_monitor(screen), &geometry); |
1193 | + gtk_window_set_default_size (window, geometry.width, geometry.height); |
1194 | + gtk_window_move (window, geometry.x, geometry.y); |
1195 | |
1196 | web_view = webkit_web_view_new (); |
1197 | g_signal_connect (G_OBJECT (web_view), "window-object-cleared", G_CALLBACK (window_object_cleared_cb), greeter); |
1198 | gtk_container_add (GTK_CONTAINER (window), web_view); |
1199 | |
1200 | - g_signal_connect (G_OBJECT (greeter), "connected", G_CALLBACK (connected_cb), web_view); |
1201 | + //g_signal_connect (G_OBJECT (greeter), "connected", G_CALLBACK (connected_cb), web_view); |
1202 | g_signal_connect (G_OBJECT (greeter), "show-prompt", G_CALLBACK (show_prompt_cb), web_view); |
1203 | g_signal_connect (G_OBJECT (greeter), "show-message", G_CALLBACK (show_message_cb), web_view); |
1204 | g_signal_connect (G_OBJECT (greeter), "show-error", G_CALLBACK (show_message_cb), web_view); |
1205 | g_signal_connect (G_OBJECT (greeter), "authentication-complete", G_CALLBACK (authentication_complete_cb), web_view); |
1206 | - g_signal_connect (G_OBJECT (greeter), "timed-login", G_CALLBACK (timed_login_cb), web_view); |
1207 | + //g_signal_connect (G_OBJECT (greeter), "timed-login", G_CALLBACK (timed_login_cb), web_view); |
1208 | g_signal_connect (G_OBJECT (greeter), "quit", G_CALLBACK (quit_cb), web_view); |
1209 | |
1210 | - ldm_greeter_connect_to_server (greeter); |
1211 | - |
1212 | + //lightdm_greeter_connect_to_server (greeter); |
1213 | + |
1214 | + webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), g_strdup_printf("file://%s/%s/index.html", THEME_DIR, theme)); |
1215 | + |
1216 | + gtk_widget_show_all (window); |
1217 | +lightdm_greeter_connect_sync (greeter, NULL); |
1218 | gtk_main (); |
1219 | |
1220 | return 0; |