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