diff --git a/NEWS b/NEWS index 99da9e81..afeaf304 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +Overview of changes in lightdm-webkit2-greeter 2.2.1 + + * Increased the timeout for the "theme loaded" check to ensure themes are given + enough time to load (when running on less powerful systems). (GH #98) + * Fixed issue where users' custom .face image failed to load. (GH #98) + Overview of changes in lightdm-webkit2-greeter 2.2 * Fixed issue where the ugly default X cursor was shown briefly after the greeter exits. diff --git a/meson.build b/meson.build index 8c89a5e3..0615d573 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('lightdm-webkit2-greeter', 'c', version: '2.2.0', license: 'GPL-3') +project('lightdm-webkit2-greeter', 'c', version: '2.2.1', license: 'GPL-3') # ================================== # diff --git a/src/greeter.c b/src/greeter.c index 173bff5b..dfe4a10c 100644 --- a/src/greeter.c +++ b/src/greeter.c @@ -172,7 +172,7 @@ show_theme_recovery_modal() { fallback_theme = "simple"; } - g_warning(log_msg); + g_warning("%s", log_msg); gtk_widget_destroy(dialog); webkit_web_view_load_uri( @@ -478,7 +478,7 @@ main(int argc, char **argv) { g_signal_connect(WEBKIT_WEB_VIEW(web_view), "context-menu", G_CALLBACK(context_menu_cb), NULL); /* Register callback to check if theme loaded successfully */ - g_timeout_add_seconds(5, (GSourceFunc) maybe_show_theme_fallback_dialog, NULL); + g_timeout_add_seconds(10, (GSourceFunc) maybe_show_theme_fallback_dialog, NULL); /* There's no turning back now, let's go! */ gtk_container_add(GTK_CONTAINER(window), web_view); diff --git a/src/webkit2-extension.c b/src/webkit2-extension.c index 0f6fc64e..4eaf757f 100644 --- a/src/webkit2-extension.c +++ b/src/webkit2-extension.c @@ -276,24 +276,33 @@ get_user_image_cb(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef *exception) { - const gchar *image_uri = lightdm_user_get_image(USER); + + const gchar *image = lightdm_user_get_image(USER); gchar *image_path; gint result; - image_path = g_filename_from_uri(image_uri, NULL, NULL); - if (image_path) { - result = g_access(image_path, R_OK); - g_free(image_path); - } else { - result = g_access(image_uri, R_OK); + // Determine if we already checked this path + for (iter = paths; iter; iter = iter->next) { + if (0 == g_strcmp0(image, iter->data)) { + // We've already checked this path, no need to continue further. + return string_or_null(context, image); + } } - if (result) { - /* Couldn't access */ - return JSValueMakeNull(context); - } else { - return string_or_null(context, image_uri); + image_path = g_strdup(image); + result = g_access(image_path, R_OK); + + if (0 == result) { + // Path is accessible. Add it to our paths list. + paths = g_slist_prepend(paths, image_path); + + return string_or_null(context, image); } + + // Path is not accessible. + g_free(image_path); + + return JSValueMakeNull(context); } @@ -1812,7 +1821,7 @@ get_config_option_as_string(const gchar *section, const gchar *key) { value = g_key_file_get_string(keyfile, section, key, &err); if (NULL != err) { - g_error(err->message); + g_error("%s", err->message); g_error_free(err); g_free(value); return ""; @@ -1835,7 +1844,7 @@ should_block_request(const char *file_path) { if (NULL != canonical_path) { for (iter = paths; iter; iter = iter->next) { - if (strcmp(canonical_path, iter->data) == 0 || g_str_has_prefix(canonical_path, iter->data)) { + if (0 == g_strcmp0(canonical_path, iter->data) || g_str_has_prefix(canonical_path, iter->data)) { result = FALSE; /* Allowed */ break; }