epiphany r8832 - trunk/src



Author: xan
Date: Sun Mar  1 19:47:02 2009
New Revision: 8832
URL: http://svn.gnome.org/viewvc/epiphany?rev=8832&view=rev

Log:
Use new get_encoding API to properly figure out automatic vs override encoding.

Modified:
   trunk/src/ephy-encoding-dialog.c
   trunk/src/ephy-encoding-menu.c

Modified: trunk/src/ephy-encoding-dialog.c
==============================================================================
--- trunk/src/ephy-encoding-dialog.c	(original)
+++ trunk/src/ephy-encoding-dialog.c	Sun Mar  1 19:47:02 2009
@@ -86,7 +86,7 @@
         GList *rows;
 	GtkWidget *button;
 	const char *encoding;
-	gboolean is_automatic;
+	gboolean is_automatic = FALSE;
 	WebKitWebView *view;
 
 	dialog->priv->update_tag = TRUE;
@@ -96,7 +96,12 @@
 
 	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
 	encoding = webkit_web_view_get_custom_encoding (view);
-	if (encoding == NULL) return;
+	if (encoding == NULL)
+	{
+		encoding = webkit_web_view_get_encoding (view);
+		if (encoding == NULL) return;
+		is_automatic = TRUE;
+	}
 
 	node = ephy_encodings_get_node (dialog->priv->encodings, encoding, TRUE);
 	g_assert (EPHY_IS_NODE (node));

Modified: trunk/src/ephy-encoding-menu.c
==============================================================================
--- trunk/src/ephy-encoding-menu.c	(original)
+++ trunk/src/ephy-encoding-menu.c	Sun Mar  1 19:47:02 2009
@@ -118,7 +118,7 @@
 	EphyNode *enc_node;
 	GList *recent, *related = NULL, *l;
 	EphyLanguageGroup groups;
-	gboolean is_automatic;
+	gboolean is_automatic = FALSE;
 	WebKitWebView *view;
 
 	START_PROFILER ("Rebuilding encoding menu")
@@ -132,18 +132,19 @@
 	/* get most recently used encodings */
 	recent = ephy_encodings_get_recent (p->encodings);
 
-	/* FIXME: need a plain get_encoding API in WebKit to complete this */
 	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (p->window));
 	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
 	encoding = webkit_web_view_get_custom_encoding (view);
-	if (encoding == NULL) goto build_menu;
+	if (encoding == NULL)
+	{
+		encoding = webkit_web_view_get_encoding (view);
+		if (encoding == NULL) goto build_menu;
+		is_automatic = TRUE;
+	}
 
 	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_embed_has_automatic_encoding (embed);
-
 	action = gtk_action_group_get_action (p->action_group,
 					      "ViewEncodingAutomatic");
 	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), is_automatic);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]