aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2009-02-27 00:37:43 +0800
committerXan Lopez <xan@src.gnome.org>2009-02-27 00:37:43 +0800
commit524007db88546cf76a6d0a0c1c512dd93058bc63 (patch)
tree1c9d1aadf4e2f3ee2c1d24c54e8b412ad0b144c1
parent01b36dd4aeebac60076b1e8d28dd1181129939bd (diff)
downloadgsoc2013-epiphany-524007db88546cf76a6d0a0c1c512dd93058bc63.tar.gz
gsoc2013-epiphany-524007db88546cf76a6d0a0c1c512dd93058bc63.tar.zst
gsoc2013-epiphany-524007db88546cf76a6d0a0c1c512dd93058bc63.zip
Implement get/set encoding for the embed.
Bug #525265 svn path=/trunk/; revision=8815
-rw-r--r--embed/ephy-embed.c2
-rw-r--r--embed/ephy-embed.h4
-rw-r--r--embed/webkit/webkit-embed.c7
-rw-r--r--src/ephy-encoding-dialog.c4
-rw-r--r--src/ephy-encoding-menu.c4
5 files changed, 10 insertions, 11 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 140d7cb98..b9721bb0f 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -583,7 +583,7 @@ ephy_embed_set_encoding (EphyEmbed *embed,
* Returns: the @embed's document encoding
*
**/
-char *
+const char *
ephy_embed_get_encoding (EphyEmbed *embed)
{
EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 36a705174..7855898b4 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -190,7 +190,7 @@ struct _EphyEmbedIface
void (* scroll_pixels) (EphyEmbed *embed,
int dx,
int dy);
- char * (* get_encoding) (EphyEmbed *embed);
+ const char * (* get_encoding) (EphyEmbed *embed);
gboolean (* has_automatic_encoding) (EphyEmbed *embed);
void (* set_encoding) (EphyEmbed *embed,
const char *encoding);
@@ -309,7 +309,7 @@ const char * ephy_embed_get_loading_title (EphyEmbed *embed);
gboolean ephy_embed_get_visibility (EphyEmbed *embed);
/* Encoding */
-char *ephy_embed_get_encoding (EphyEmbed *embed);
+const char *ephy_embed_get_encoding (EphyEmbed *embed);
gboolean ephy_embed_has_automatic_encoding (EphyEmbed *embed);
diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c
index aa512f24f..0460d7d3a 100644
--- a/embed/webkit/webkit-embed.c
+++ b/embed/webkit/webkit-embed.c
@@ -561,12 +561,15 @@ static void
impl_set_encoding (EphyEmbed *embed,
const char *encoding)
{
+ WebKitWebView *view = WEBKIT_EMBED (embed)->priv->web_view;
+ webkit_web_view_set_custom_encoding (view, encoding);
}
-static char *
+static const char *
impl_get_encoding (EphyEmbed *embed)
{
- return NULL;
+ WebKitWebView *view = WEBKIT_EMBED (embed)->priv->web_view;
+ return webkit_web_view_get_custom_encoding (view);;
}
static gboolean
diff --git a/src/ephy-encoding-dialog.c b/src/ephy-encoding-dialog.c
index 5a2c3ba3f..64a343868 100644
--- a/src/ephy-encoding-dialog.c
+++ b/src/ephy-encoding-dialog.c
@@ -83,7 +83,7 @@ sync_encoding_against_embed (EphyEncodingDialog *dialog)
GtkTreeModel *model;
GList *rows;
GtkWidget *button;
- char *encoding;
+ const char *encoding;
gboolean is_automatic;
dialog->priv->update_tag = TRUE;
@@ -123,8 +123,6 @@ sync_encoding_against_embed (EphyEncodingDialog *dialog)
button = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[AUTOMATIC_PROP].id);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), is_automatic);
- g_free (encoding);
-
dialog->priv->update_tag = FALSE;
}
diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c
index 0b56cc7e1..682a22747 100644
--- a/src/ephy-encoding-menu.c
+++ b/src/ephy-encoding-menu.c
@@ -112,7 +112,7 @@ update_encoding_menu_cb (GtkAction *dummy, EphyEncodingMenu *menu)
EphyEmbed *embed;
GtkAction *action;
char name[128];
- char *encoding;
+ const char *encoding;
EphyNode *enc_node;
GList *recent, *related = NULL, *l;
EphyLanguageGroup groups;
@@ -219,8 +219,6 @@ build_menu:
g_list_free (related);
g_list_free (recent);
- g_free (encoding);
-
menu->priv->update_tag = FALSE;
STOP_PROFILER ("Rebuilding encoding menu")