From: Daniel Carl <danielcarl@gmx.de>
Date: Mon, 27 Aug 2018 21:05:53 +0000 (+0200)
Subject: Check webextension at startup by default.
X-Git-Url: https://git.owens.tech/about.html/about.html/git?a=commitdiff_plain;h=4f1fce384aadc00caf04a562e9914ddc1baee4d7;p=vimb.git

Check webextension at startup by default.

Also fail with error if webextension could not be read.
---

diff --git a/src/config.def.h b/src/config.def.h
index 829a30e..5d36c4b 100644
--- a/src/config.def.h
+++ b/src/config.def.h
@@ -55,3 +55,6 @@
 /* default window dimensions */
 #define WIN_WIDTH                  800
 #define WIN_HEIGHT                 600
+
+/* if set to 1 vimb will check if the webextension could be found. */
+#define CHECK_WEBEXTENSION_ON_STARTUP 1
diff --git a/src/main.c b/src/main.c
index 46d6fcb..071078f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1044,10 +1044,10 @@ static void on_webctx_init_web_extension(WebKitWebContext *webctx, gpointer data
     const char *name;
     GVariant *vdata;
 
-#ifdef DEBUG
+#if (CHECK_WEBEXTENSION_ON_STARTUP)
     char *extension = g_build_filename(EXTENSIONDIR,  "webext_main.so", NULL);
     if (!g_file_test(extension, G_FILE_TEST_IS_REGULAR)) {
-        g_warning("Cannot access web extension %s", extension);
+        g_error("Cannot access web extension %s", extension);
     }
     g_free(extension);
 #endif