summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hofmann <scm@uninformativ.de>2021-06-13 07:22:49 +0200
committerPeter Hofmann <scm@uninformativ.de>2021-06-13 07:22:49 +0200
commit32da447da9cc523407366787d597d4204350d6c5 (patch)
tree9c748350c441bd17fed01fabd4348f3efb0892f3
parent068f91e41aebee1df65c75967641888125f6dcb6 (diff)
downloadlariza-32da447da9cc523407366787d597d4204350d6c5.tar.gz
Work around weirdness in setting a preferred language
-rw-r--r--CHANGES4
-rw-r--r--browser.c15
2 files changed, 16 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index dfc17e4..7d137af 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,9 @@
Release history for lariza
+next
+ [Fixed]
+ - Setting a preferred language works again (workaround in place).
+
v21.01 2021-01-22
[Changed]
- The file "adblock.black" has been renamed to "adblock".
diff --git a/browser.c b/browser.c
index ebab7fb..77ea6ff 100644
--- a/browser.c
+++ b/browser.c
@@ -127,6 +127,7 @@ client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show,
struct Client *c;
gchar *f;
GtkWidget *evbox, *tabbox;
+ WebKitWebContext *wc;
if (uri != NULL && cooperative_instances && !cooperative_alone)
{
@@ -151,6 +152,17 @@ client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show,
else
c->web_view = webkit_web_view_new_with_related_view(related_wv);
+ /* XXX We have just created a new WebView with either the default
+ * WebContext (if related_wv == NULL) or a WebView with an inherited
+ * context. Still, it doesn't use the preferred languages we might
+ * have set on the default WebContext. This used to work. New bug in
+ * WebKit or changed API? */
+ if (accepted_language[0] != NULL)
+ {
+ wc = webkit_web_view_get_context(WEBKIT_WEB_VIEW(c->web_view));
+ webkit_web_context_set_preferred_languages(wc, accepted_language);
+ }
+
webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(c->web_view), global_zoom);
g_signal_connect(G_OBJECT(c->web_view), "notify::favicon",
G_CALLBACK(changed_favicon), c);
@@ -851,9 +863,6 @@ init_default_web_context(void)
webkit_web_context_set_web_extensions_directory(wc, p);
g_free(p);
- if (accepted_language[0] != NULL)
- webkit_web_context_set_preferred_languages(wc, accepted_language);
-
g_signal_connect(G_OBJECT(wc), "download-started",
G_CALLBACK(download_handle_start), NULL);