From 8163b444951c6742ad2899b060ffcfaa588cd0ed Mon Sep 17 00:00:00 2001 From: Dustin Falgout Date: Fri, 30 Sep 2016 22:13:04 -0500 Subject: [PATCH] still fighting to get the webkit extension to work again --- meson.build | 4 +++- meson_options.txt | 28 +++++++++++++++++++--------- src/greeter.c | 8 ++++---- src/meson.build | 8 ++------ src/webkit2-extension.c | 3 +-- 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/meson.build b/meson.build index f308a6b..02fc495 100644 --- a/meson.build +++ b/meson.build @@ -47,7 +47,7 @@ conf.set('AS_MICRO_VERSION', as_micro_version) conf.set('GETTEXT_PACKAGE', '"lightdm-webkit2-greeter"') -conf.set('LOCALE_DIR', '"@0@/@1@"'.format(get_option('datadir'), 'locale')) +conf.set('LOCALE_DIR', '"@0@"'.format(get_option('with-locale-dir'))) conf.set('THEME_DIR', '"@0@"'.format(get_option('with-theme-dir'))) @@ -55,6 +55,8 @@ conf.set('CONFIG_DIR', '"@0@"'.format(get_option('with-config-dir'))) conf.set('DESKTOP_DIR', '"@0@"'.format(get_option('with-desktop-dir'))) +conf.set('WEBEXT_DIR', '"@0@"'.format(get_option('with-webext-dir'))) + # ===================================== # # ------->>> Sub Directories <<<------- # diff --git a/meson_options.txt b/meson_options.txt index d722e2a..238c929 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,14 +1,24 @@ option('with-theme-dir', - type : 'string', - value : '/usr/share/lightdm-webkit/themes', - description : 'Directory to use for greeter themes') + type: 'string', + value: '/usr/share/lightdm-webkit/themes/', + description: 'Directory to use for greeter themes') option('with-config-dir', - type : 'string', - value : '/etc/lightdm/', - description : 'LightDM configuration directory') + type: 'string', + value: '/etc/lightdm/', + description: 'LightDM configuration directory') option('with-desktop-dir', - type : 'string', - value : '/usr/share/xgreeters/', - description : 'LightDM greeters directory') \ No newline at end of file + type: 'string', + value: '/usr/share/xgreeters/', + description: 'LightDM greeters directory') + +option('with-webext-dir', + type: 'string', + value: '/usr/lib/lightdm-webkit2-greeter/', + description: 'Directory for the greeter webkit extension') + +option('with-locale-dir', + type: 'string', + value: '/usr/share/locale/', + description: 'Locale directory') diff --git a/src/greeter.c b/src/greeter.c index e1603fc..db208c1 100644 --- a/src/greeter.c +++ b/src/greeter.c @@ -94,7 +94,7 @@ wm_window_filter(GdkXEvent *gxevent, GdkEvent *event, gpointer data) { static void initialize_web_extensions_cb(WebKitWebContext *context, gpointer user_data) { - webkit_web_context_set_web_extensions_directory(context, LIGHTDM_WEBKIT2_GREETER_EXTENSIONS_DIR); + webkit_web_context_set_web_extensions_directory(context, WEBEXT_DIR); } @@ -137,7 +137,7 @@ check_theme_heartbeat(void) { g_warning("[ERROR] :: A problem was detected with the current theme. Falling back to simple theme..."); webkit_web_view_load_uri( WEBKIT_WEB_VIEW(web_view), - g_strdup_printf("file://%s/simple/index.html", THEME_DIR) + g_strdup_printf("file://%ssimple/index.html", THEME_DIR) ); } @@ -347,7 +347,7 @@ main(int argc, char **argv) { keyfile = g_key_file_new(); g_key_file_load_from_file(keyfile, - CONFIG_DIR "/lightdm-webkit2-greeter.conf", + CONFIG_DIR "lightdm-webkit2-greeter.conf", G_KEY_FILE_NONE, NULL); theme = g_key_file_get_string(keyfile, "greeter", "webkit-theme", NULL); @@ -426,7 +426,7 @@ main(int argc, char **argv) { /* There's no turning back now, let's go! */ gtk_container_add(GTK_CONTAINER(window), web_view); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view), - g_strdup_printf("file://%s/%s/index.html", THEME_DIR, theme)); + g_strdup_printf("file://%s%s/index.html", THEME_DIR, theme)); gtk_widget_show_all(window); diff --git a/src/meson.build b/src/meson.build index 70c82ea..7fe2091 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,7 +1,8 @@ configure_file(output: 'config.h', configuration: conf) gresource_sources = include_directories('gresource') -extdir = '@0@/@1@'.format(get_option('libdir'), 'lightdm-webkit2-greeter') +_ = get_option('with-webext-dir').split('"') +extdir = _[0] # ======================================= # # ------->>> Webkit2 Extension <<<------- # @@ -24,15 +25,10 @@ webext = library( greeter_sources = ['gresource/greeter-resources.c', 'greeter.c'] -greeter_cargs = [ - '-DLIGHTDM_WEBKIT2_GREETER_EXTENSIONS_DIR="@0@"'.format(extdir) -] - greeter = executable( 'lightdm-webkit2-greeter', greeter_sources, dependencies: greeter_deps, - c_args: greeter_cargs, include_directories : gresource_sources, install: true ) diff --git a/src/webkit2-extension.c b/src/webkit2-extension.c index 1179335..af758f1 100644 --- a/src/webkit2-extension.c +++ b/src/webkit2-extension.c @@ -1460,7 +1460,6 @@ window_object_cleared_callback(WebKitScriptWorld *world, greeter_util_object, globalObject; JSStringRef command; - JSStringRef heartbeat_command; gchar *lock_hint_message = "LockHint"; gchar *page_loaded_message = "PageLoaded"; @@ -1687,7 +1686,7 @@ webkit_web_extension_initialize(WebKitWebExtension *extension) { keyfile = g_key_file_new(); g_key_file_load_from_file(keyfile, - CONFIG_DIR "/lightdm-webkit2-greeter.conf", + CONFIG_DIR "lightdm-webkit2-greeter.conf", G_KEY_FILE_NONE, NULL); }