aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2012-08-23 18:09:04 +0800
committerCarlos Garcia Campos <carlosgc@gnome.org>2012-09-02 16:55:26 +0800
commit815e51df8f3c080aaab113257f6eabb8392f9684 (patch)
tree26e368ea27e3f05c178571fbb02b36e4d1b848ab /embed
parent4f81935681945df5883f59a218bfb7ea3b29a1d8 (diff)
downloadgsoc2013-epiphany-815e51df8f3c080aaab113257f6eabb8392f9684.tar
gsoc2013-epiphany-815e51df8f3c080aaab113257f6eabb8392f9684.tar.gz
gsoc2013-epiphany-815e51df8f3c080aaab113257f6eabb8392f9684.tar.bz2
gsoc2013-epiphany-815e51df8f3c080aaab113257f6eabb8392f9684.tar.lz
gsoc2013-epiphany-815e51df8f3c080aaab113257f6eabb8392f9684.tar.xz
gsoc2013-epiphany-815e51df8f3c080aaab113257f6eabb8392f9684.tar.zst
gsoc2013-epiphany-815e51df8f3c080aaab113257f6eabb8392f9684.zip
ephy-embed-prefs: Port preferred languages to WebKit2
https://bugzilla.gnome.org/show_bug.cgi?id=679685
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed-prefs.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index 554d6d5cd..2c9346310 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -283,6 +283,7 @@ webkit_pref_callback_font_family (GSettings *settings,
g_free (value);
}
+#ifndef HAVE_WEBKIT2
/* Part of this code taken from libsoup (soup-session.c) */
static gchar *
build_accept_languages_header (GArray *languages)
@@ -325,6 +326,7 @@ build_accept_languages_header (GArray *languages)
return langs_str;
}
+#endif
/* Based on Christian Persch's code from gecko backend of epiphany
(old transform_accept_languages_list() function) */
@@ -333,18 +335,15 @@ webkit_pref_callback_accept_languages (GSettings *settings,
char *key,
gpointer data)
{
-#ifdef HAVE_WEBKIT2
- /* TODO: Languages */
-#else
+#ifndef HAVE_WEBKIT2
SoupSession *session;
+ char *webkit_pref = data;
+ char *langs_str;
+#endif
GArray *array;
char **languages;
- char *langs_str;
- char *webkit_pref;
int i;
- webkit_pref = data;
-
languages = g_settings_get_strv (settings, key);
array = g_array_new (TRUE, FALSE, sizeof (char *));
@@ -360,16 +359,21 @@ webkit_pref_callback_accept_languages (GSettings *settings,
ephy_langs_sanitise (array);
+#ifdef HAVE_WEBKIT2
+ webkit_web_context_set_preferred_languages (webkit_web_context_get_default (),
+ (const char * const *)array->data);
+#else
langs_str = build_accept_languages_header (array);
/* Update Soup session */
session = webkit_get_default_session ();
g_object_set (G_OBJECT (session), webkit_pref, langs_str, NULL);
- g_strfreev (languages);
g_free (langs_str);
- g_array_free (array, TRUE);
#endif
+
+ g_strfreev (languages);
+ g_array_free (array, TRUE);
}