aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-encoding-menu.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-05-02 04:47:00 +0800
committerChristian Persch <chpe@src.gnome.org>2004-05-02 04:47:00 +0800
commit7093f6ad148d62a9ddc77f8080cf9822d5d24f1f (patch)
tree672ab4fb4d9e9853b14903b6c9019e911773fd93 /src/ephy-encoding-menu.c
parent8493f7c5d64b577b3f6b8de91e5bb6c82a8b96ae (diff)
downloadgsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar
gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.gz
gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.bz2
gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.lz
gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.xz
gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.tar.zst
gsoc2013-epiphany-7093f6ad148d62a9ddc77f8080cf9822d5d24f1f.zip
Clean up encoding handling.
2004-05-01 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-embed.c: (ephy_embed_get_encoding), (ephy_embed_has_automatic_encoding): * embed/ephy-embed.h: * embed/ephy-encodings.c: * embed/ephy-encodings.h: * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: * embed/mozilla/MozRegisterComponents.cpp: * embed/mozilla/mozilla-embed.cpp: * src/ephy-encoding-dialog.c: (sync_embed_cb), (activate_choice): * src/ephy-encoding-menu.c: (update_encoding_menu_cb), (encoding_activate_cb): Clean up encoding handling.
Diffstat (limited to 'src/ephy-encoding-menu.c')
-rw-r--r--src/ephy-encoding-menu.c33
1 files changed, 6 insertions, 27 deletions
diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c
index 3eade8ced..b35ada0e6 100644
--- a/src/ephy-encoding-menu.c
+++ b/src/ephy-encoding-menu.c
@@ -150,9 +150,8 @@ update_encoding_menu_cb (GtkAction *dummy, EphyEncodingMenu *menu)
EphyEncodingMenuPrivate *p = menu->priv;
EphyEmbed *embed;
GtkAction *action;
- EphyEncodingInfo *info;
char name[128];
- const char *encoding;
+ char *encoding;
EphyNode *enc_node;
GList *recent, *related = NULL, *l;
EphyLanguageGroup groups;
@@ -170,24 +169,14 @@ update_encoding_menu_cb (GtkAction *dummy, EphyEncodingMenu *menu)
recent = ephy_encodings_get_recent (p->encodings);
embed = ephy_window_get_active_embed (p->window);
- info = ephy_embed_get_encoding_info (embed);
- if (info == NULL) goto build_menu;
-
- LOG ("encoding information\n enc='%s' default='%s' hint='%s' "
- "prev_doc='%s' forced='%s' parent='%s' source=%d "
- "hint_source=%d parent_source=%d", info->encoding,
- info->default_encoding, info->hint_encoding,
- info->prev_doc_encoding, info->forced_encoding,
- info->parent_encoding, info->encoding_source,
- info->hint_encoding_source, info->parent_encoding_source)
-
- encoding = info->encoding;
+ encoding = ephy_embed_get_encoding (embed);
+ if (encoding == NULL) goto build_menu;
enc_node = ephy_encodings_get_node (p->encodings, encoding, TRUE);
g_assert (EPHY_IS_NODE (enc_node));
/* check if encoding was overridden */
- is_automatic = ephy_encoding_info_is_automatic (info);
+ is_automatic = ephy_embed_has_automatic_encoding (embed);
action = gtk_action_group_get_action (p->action_group,
"ViewEncodingAutomatic");
@@ -269,7 +258,7 @@ build_menu:
g_list_free (related);
g_list_free (recent);
- ephy_encoding_info_free (info);
+ g_free (encoding);
menu->priv->update_tag = FALSE;
@@ -280,7 +269,6 @@ static void
encoding_activate_cb (GtkAction *action, EphyEncodingMenu *menu)
{
EphyEmbed *embed;
- EphyEncodingInfo *info;
const char *name, *encoding;
if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) == FALSE
@@ -294,16 +282,7 @@ encoding_activate_cb (GtkAction *action, EphyEncodingMenu *menu)
embed = ephy_window_get_active_embed (menu->priv->window);
- info = ephy_embed_get_encoding_info (embed);
- if (info == NULL) return;
-
- /* Force only when different from current encoding */
- if (info->encoding && strcmp (info->encoding, encoding) != 0)
- {
- ephy_embed_set_encoding (embed, encoding);
- }
-
- ephy_encoding_info_free (info);
+ ephy_embed_set_encoding (embed, encoding);
ephy_encodings_add_recent (menu->priv->encodings, encoding);
}