epiphany r8817 - in trunk: embed embed/webkit src



Author: xan
Date: Thu Feb 26 17:46:41 2009
New Revision: 8817
URL: http://svn.gnome.org/viewvc/epiphany?rev=8817&view=rev

Log:
Remove embedding APIs for set/get encoding.

Use WebKit API directly.

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

Modified: trunk/embed/ephy-embed.c
==============================================================================
--- trunk/embed/ephy-embed.c	(original)
+++ trunk/embed/ephy-embed.c	Thu Feb 26 17:46:41 2009
@@ -556,41 +556,6 @@
 }
 
 /**
- * ephy_embed_set_encoding:
- * @embed: an #EphyEmbed
- * @encoding: the desired encoding
- *
- * Sets @embed's character encoding to @encoding. These cryptic encoding
- * strings are listed in <filename>embed/ephy-encodings.c</filename>.
- *
- * Pass an empty string (not NULL) in @encoding to reset @embed to use the
- * document-specified encoding.
- **/
-void
-ephy_embed_set_encoding (EphyEmbed *embed,
-			 const char *encoding)
-{
-	EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
-	iface->set_encoding (embed, encoding);
-}
-
-/**
- * ephy_embed_get_encoding:
- * @embed: an #EphyEmbed
- *
- * Returns the @embed's document encoding.
- *
- * Returns: the @embed's document encoding
- *
- **/
-const char *
-ephy_embed_get_encoding (EphyEmbed *embed)
-{
-	EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
-	return iface->get_encoding (embed);
-}
-
-/**
  * ephy_embed_has_automatic_encoding:
  * @embed: an #EphyEmbed
  *

Modified: trunk/embed/ephy-embed.h
==============================================================================
--- trunk/embed/ephy-embed.h	(original)
+++ trunk/embed/ephy-embed.h	Thu Feb 26 17:46:41 2009
@@ -190,10 +190,7 @@
 	void		   (* scroll_pixels)		  (EphyEmbed *embed,
 							   int dx,
 							   int dy);
-	const char *	   (* get_encoding)		  (EphyEmbed *embed);
 	gboolean	   (* has_automatic_encoding)	  (EphyEmbed *embed);
-	void		   (* set_encoding)		  (EphyEmbed *embed,
-							   const char *encoding);
 	void		   (* set_print_preview_mode)	  (EphyEmbed *embed,
 							   gboolean mode);
 	int		   (* print_preview_n_pages)	  (EphyEmbed *embed);
@@ -308,13 +305,7 @@
 const char *	 ephy_embed_get_loading_title		(EphyEmbed *embed);
 
 gboolean	 ephy_embed_get_visibility		(EphyEmbed *embed);
-/* Encoding */
-const char	 *ephy_embed_get_encoding		(EphyEmbed *embed);
-
-gboolean	  ephy_embed_has_automatic_encoding	(EphyEmbed *embed);
-
-void		  ephy_embed_set_encoding		(EphyEmbed *embed,
-							 const char *encoding);
+gboolean	 ephy_embed_has_automatic_encoding	(EphyEmbed *embed);
 
 /* Print */
 void		  ephy_embed_set_print_preview_mode	(EphyEmbed *embed,

Modified: trunk/embed/webkit/webkit-embed.c
==============================================================================
--- trunk/embed/webkit/webkit-embed.c	(original)
+++ trunk/embed/webkit/webkit-embed.c	Thu Feb 26 17:46:41 2009
@@ -557,21 +557,6 @@
 {
 }
 
-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 const char *
-impl_get_encoding (EphyEmbed *embed)
-{
-  WebKitWebView *view = WEBKIT_EMBED (embed)->priv->web_view;
-  return webkit_web_view_get_custom_encoding (view);
-}
-
 static gboolean
 impl_has_automatic_encoding (EphyEmbed *embed)
 {
@@ -596,8 +581,6 @@
   iface->get_js_status = impl_get_js_status;
   iface->shistory_copy = impl_shistory_copy;
   iface->show_page_certificate = impl_show_page_certificate;
-  iface->set_encoding = impl_set_encoding;
-  iface->get_encoding = impl_get_encoding;
   iface->has_automatic_encoding = impl_has_automatic_encoding;
   iface->set_print_preview_mode = impl_set_print_preview_mode;
   iface->print_preview_n_pages = impl_print_preview_n_pages;

Modified: trunk/src/ephy-encoding-dialog.c
==============================================================================
--- trunk/src/ephy-encoding-dialog.c	(original)
+++ trunk/src/ephy-encoding-dialog.c	Thu Feb 26 17:46:41 2009
@@ -26,6 +26,7 @@
 #include "ephy-embed.h"
 #include "ephy-embed-container.h"
 #include "ephy-embed-shell.h"
+#include "ephy-embed-utils.h"
 #include "ephy-file-helpers.h"
 #include "ephy-shell.h"
 #include "ephy-node.h"
@@ -36,6 +37,7 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 #include <string.h>
+#include <webkit/webkit.h>
 
 enum
 {
@@ -85,13 +87,15 @@
 	GtkWidget *button;
 	const char *encoding;
 	gboolean is_automatic;
+	WebKitWebView *view;
 
 	dialog->priv->update_tag = TRUE;
 
 	embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG (dialog));
 	g_return_if_fail (EPHY_IS_EMBED (embed));
 
-	encoding = ephy_embed_get_encoding (embed);
+	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+	encoding = webkit_web_view_get_custom_encoding (view);
 	if (encoding == NULL) return;
 
 	node = ephy_encodings_get_node (dialog->priv->encodings, encoding, TRUE);
@@ -194,6 +198,7 @@
 	EphyEmbed *embed;
 	GtkWidget *button;
 	gboolean is_automatic;
+	WebKitWebView *view;
 
 	embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG (dialog));
 	g_return_if_fail (EPHY_IS_EMBED (embed));
@@ -201,9 +206,11 @@
 	button = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[AUTOMATIC_PROP].id);
 	is_automatic = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
 
+	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+
 	if (is_automatic)
 	{
-		ephy_embed_set_encoding (embed, "");
+		webkit_web_view_set_custom_encoding (view, NULL);
 	}
 	else if (dialog->priv->selected_node != NULL)
 	{
@@ -212,7 +219,7 @@
 		code = ephy_node_get_property_string (dialog->priv->selected_node,
 						      EPHY_NODE_ENCODING_PROP_ENCODING);
 
-		ephy_embed_set_encoding (embed, code);
+		webkit_web_view_set_custom_encoding (view, code);
 
 		ephy_encodings_add_recent (dialog->priv->encodings, code);
 	}

Modified: trunk/src/ephy-encoding-menu.c
==============================================================================
--- trunk/src/ephy-encoding-menu.c	(original)
+++ trunk/src/ephy-encoding-menu.c	Thu Feb 26 17:46:41 2009
@@ -28,12 +28,14 @@
 #include "ephy-embed.h"
 #include "ephy-embed-container.h"
 #include "ephy-embed-shell.h"
+#include "ephy-embed-utils.h"
 #include "ephy-shell.h"
 #include "ephy-debug.h"
 
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 #include <string.h>
+#include <webkit/webkit.h>
 
 #define EPHY_ENCODING_MENU_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ENCODING_MENU, EphyEncodingMenuPrivate))
 
@@ -117,6 +119,7 @@
 	GList *recent, *related = NULL, *l;
 	EphyLanguageGroup groups;
 	gboolean is_automatic;
+	WebKitWebView *view;
 
 	START_PROFILER ("Rebuilding encoding menu")
 
@@ -130,7 +133,8 @@
 	recent = ephy_encodings_get_recent (p->encodings);
 
 	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (p->window));
-	encoding = ephy_embed_get_encoding (embed);
+	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+	encoding = webkit_web_view_get_custom_encoding (view);
 	if (encoding == NULL) goto build_menu;
 
 	enc_node = ephy_encodings_get_node (p->encodings, encoding, TRUE);
@@ -228,6 +232,7 @@
 encoding_activate_cb (GtkAction *action, EphyEncodingMenu *menu)
 {
 	EphyEmbed *embed;
+	WebKitWebView *view;
 	const char *name, *encoding;
 
 	if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) == FALSE
@@ -241,7 +246,8 @@
 
 	embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (menu->priv->window));
 
-	ephy_embed_set_encoding (embed, encoding);
+	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+	webkit_web_view_set_custom_encoding (view, encoding);
 
 	ephy_encodings_add_recent (menu->priv->encodings, encoding);
 }
@@ -301,6 +307,7 @@
 ephy_encoding_menu_automatic_cb (GtkAction *action, EphyEncodingMenu *menu)
 {
 	EphyEmbed *embed;
+	WebKitWebView *view;
 
 	if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) == FALSE
 	    || menu->priv->update_tag)
@@ -311,8 +318,9 @@
 	embed = ephy_embed_container_get_active_child 
           (EPHY_EMBED_CONTAINER (menu->priv->window));
 
-	/* setting "" will clear the forced encoding */
-	ephy_embed_set_encoding (embed, "");
+	/* setting NULL will clear the forced encoding */
+	view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+	webkit_web_view_set_custom_encoding (view, NULL);
 }
 
 static const GtkActionEntry menu_entries [] =



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