aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-encoding-dialog.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2012-05-06 22:47:19 +0800
committerCarlos Garcia Campos <carlosgc@gnome.org>2012-06-21 19:54:16 +0800
commit97c91b2fc2059b1e358bb19896203afaa44bfd33 (patch)
tree6aa01250a99fa884d177ce3202d8ff41e8e96d74 /src/ephy-encoding-dialog.c
parenta8767266443074689200fff9ca43531d88d65aed (diff)
downloadgsoc2013-epiphany-97c91b2fc2059b1e358bb19896203afaa44bfd33.tar.gz
gsoc2013-epiphany-97c91b2fc2059b1e358bb19896203afaa44bfd33.tar.zst
gsoc2013-epiphany-97c91b2fc2059b1e358bb19896203afaa44bfd33.zip
Initial WebKit2 port
It builds and basic functionality works.
Diffstat (limited to 'src/ephy-encoding-dialog.c')
-rw-r--r--src/ephy-encoding-dialog.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ephy-encoding-dialog.c b/src/ephy-encoding-dialog.c
index 0579f4505..95a0b070c 100644
--- a/src/ephy-encoding-dialog.c
+++ b/src/ephy-encoding-dialog.c
@@ -36,7 +36,11 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#ifdef HAVE_WEBKIT2
+#include <webkit2/webkit2.h>
+#else
#include <webkit/webkit.h>
+#endif
#define EPHY_ENCODING_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ENCODING_DIALOG, EphyEncodingDialogPrivate))
@@ -75,6 +79,10 @@ sync_encoding_against_embed (EphyEncodingDialog *dialog)
g_return_if_fail (EPHY_IS_EMBED (embed));
view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+#ifdef HAVE_WEBKIT2
+ encoding = webkit_web_view_get_custom_charset (view);
+ if (encoding == NULL) return;
+#else
encoding = webkit_web_view_get_custom_encoding (view);
if (encoding == NULL)
{
@@ -82,6 +90,7 @@ sync_encoding_against_embed (EphyEncodingDialog *dialog)
if (encoding == NULL) return;
is_automatic = TRUE;
}
+#endif
node = ephy_encodings_get_node (dialog->priv->encodings, encoding, TRUE);
g_assert (EPHY_IS_NODE (node));
@@ -195,7 +204,11 @@ activate_choice (EphyEncodingDialog *dialog)
if (is_automatic)
{
+#ifdef HAVE_WEBKIT2
+ webkit_web_view_set_custom_charset (view, NULL);
+#else
webkit_web_view_set_custom_encoding (view, NULL);
+#endif
}
else if (dialog->priv->selected_node != NULL)
{
@@ -204,7 +217,11 @@ activate_choice (EphyEncodingDialog *dialog)
code = ephy_node_get_property_string (dialog->priv->selected_node,
EPHY_NODE_ENCODING_PROP_ENCODING);
+#ifdef HAVE_WEBKIT2
+ webkit_web_view_set_custom_charset (view, code);
+#else
webkit_web_view_set_custom_encoding (view, code);
+#endif
ephy_encodings_add_recent (dialog->priv->encodings, code);
}