epiphany r8312 - in trunk: doc/reference/tmpl embed embed/webkit src



Author: xan
Date: Mon Jun 30 07:23:52 2008
New Revision: 8312
URL: http://svn.gnome.org/viewvc/epiphany?rev=8312&view=rev

Log:
embed: remove ephy_embed_get_{next,previous}_history_item.

Use WebKit APIs directly.


Modified:
   trunk/doc/reference/tmpl/ephy-embed.sgml
   trunk/embed/ephy-embed.c
   trunk/embed/ephy-embed.h
   trunk/embed/webkit/webkit-embed.c
   trunk/src/ephy-window.c

Modified: trunk/doc/reference/tmpl/ephy-embed.sgml
==============================================================================
--- trunk/doc/reference/tmpl/ephy-embed.sgml	(original)
+++ trunk/doc/reference/tmpl/ephy-embed.sgml	Mon Jun 30 07:23:52 2008
@@ -327,8 +327,6 @@
 @get_is_blank: 
 @get_loading_title: 
 @get_visibility: 
- get_next_history_item: 
- get_previous_history_item: 
 @go_to_history_item: 
 
 <!-- ##### ENUM EphyEmbedChrome ##### -->

Modified: trunk/embed/ephy-embed.c
==============================================================================
--- trunk/embed/ephy-embed.c	(original)
+++ trunk/embed/ephy-embed.c	Mon Jun 30 07:23:52 2008
@@ -995,36 +995,6 @@
 }
 
 /**
- * ephy_embed_get_previous_history_item:
- * @embed: an #EphyEmbed
- *
- * Returns the preceding #EphyHistoryItem in the history list.
- *
- * Return value: the preceding #EphyHistoryItem
- **/
-EphyHistoryItem*
-ephy_embed_get_previous_history_item (EphyEmbed *embed)
-{
-	EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
-	return iface->get_previous_history_item (embed);
-}
-
-/**
- * ephy_embed_get_next_history_item:
- * @embed: an #EphyEmbed
- *
- * Returns the succeeding #EphyHistoryItem in the history list.
- *
- * Return value: the succeeding #EphyHistoryItem
- **/
-EphyHistoryItem*
-ephy_embed_get_next_history_item (EphyEmbed *embed)
-{
-	EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
-	return iface->get_next_history_item (embed);
-}
-
-/**
  * ephy_embed_go_to_history_item:
  * @embed: an #EphyEmbed
  * @history_item: an #EphyHistoryItem

Modified: trunk/embed/ephy-embed.h
==============================================================================
--- trunk/embed/ephy-embed.h	(original)
+++ trunk/embed/ephy-embed.h	Mon Jun 30 07:23:52 2008
@@ -224,8 +224,6 @@
 	gboolean	   (* get_is_blank)		  (EphyEmbed *embed);
 	const char *	   (* get_loading_title)	  (EphyEmbed *embed);
 	gboolean	   (* get_visibility)		  (EphyEmbed *embed);
-	EphyHistoryItem *  (* get_next_history_item)	  (EphyEmbed *embed);
-	EphyHistoryItem *  (* get_previous_history_item)  (EphyEmbed *embed);
 	void		   (* go_to_history_item)	  (EphyEmbed *embed,
 							   EphyHistoryItem *history_item);
 };
@@ -352,8 +350,6 @@
 gboolean	  ephy_embed_has_modified_forms		(EphyEmbed *embed);
 
 /* History */
-EphyHistoryItem *ephy_embed_get_next_history_item	(EphyEmbed *embed);
-EphyHistoryItem *ephy_embed_get_previous_history_item	(EphyEmbed *embed);
 void		 ephy_embed_go_to_history_item		(EphyEmbed *embed, EphyHistoryItem *history_item);
 
 G_END_DECLS

Modified: trunk/embed/webkit/webkit-embed.c
==============================================================================
--- trunk/embed/webkit/webkit-embed.c	(original)
+++ trunk/embed/webkit/webkit-embed.c	Mon Jun 30 07:23:52 2008
@@ -53,13 +53,6 @@
     WEBKIT_EMBED_LOAD_STOPPED
 } WebKitEmbedLoadState;
 
-
-typedef enum
-{
-  WEBKIT_HISTORY_BACKWARD,
-  WEBKIT_HISTORY_FORWARD
-} WebKitHistoryType;
-
 struct WebKitEmbedPrivate
 {
   WebKitWebView *web_view;
@@ -69,24 +62,6 @@
   EphyHistory *history;
 };
 
-static EphyHistoryItem*
-webkit_construct_history_item (WebKitEmbed *embed, WebKitHistoryType hist_type)
-{
-  WebKitWebBackForwardList *web_back_forward_list;
-  WebKitWebHistoryItem *history_item;
-
-  g_return_val_if_fail (WEBKIT_IS_EMBED (embed), NULL);
-
-  web_back_forward_list = webkit_web_view_get_back_forward_list (embed->priv->web_view);
-
-  if (hist_type == WEBKIT_HISTORY_FORWARD)
-    history_item = webkit_web_back_forward_list_get_forward_item (web_back_forward_list);
-  else
-    history_item = webkit_web_back_forward_list_get_back_item (web_back_forward_list);
-
-  return webkit_history_item_new (history_item);
-}
-
 static void
 impl_manager_do_command (EphyCommandManager *manager,
                          const char *command)
@@ -476,19 +451,6 @@
   return FALSE;
 }
 
-static EphyHistoryItem*
-impl_get_next_history_item (EphyEmbed *embed)
-{
-  return webkit_construct_history_item (WEBKIT_EMBED (embed), WEBKIT_HISTORY_FORWARD);
-}
-
-
-static EphyHistoryItem*
-impl_get_previous_history_item  (EphyEmbed *embed)
-{
-  return webkit_construct_history_item (WEBKIT_EMBED (embed), WEBKIT_HISTORY_BACKWARD);
-}
-
 static void
 impl_go_to_history_item (EphyEmbed *embed, EphyHistoryItem *history_item)
 {
@@ -524,7 +486,5 @@
   iface->print_preview_navigate = impl_print_preview_navigate;
   iface->has_modified_forms = impl_has_modified_forms;
   iface->get_security_level = impl_get_security_level;
-  iface->get_next_history_item = impl_get_next_history_item;
-  iface->get_previous_history_item = impl_get_previous_history_item;
   iface->go_to_history_item = impl_go_to_history_item;
 }

Modified: trunk/src/ephy-window.c
==============================================================================
--- trunk/src/ephy-window.c	(original)
+++ trunk/src/ephy-window.c	Mon Jun 30 07:23:52 2008
@@ -65,6 +65,7 @@
 #include <libgnomeui/gnome-stock-icons.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
+#include <webkit/webkit.h>
 
 #ifdef HAVE_X11_XF86KEYSYM_H
 #include <X11/XF86keysym.h>
@@ -1615,9 +1616,11 @@
 		     EphyWindow *window)
 {
 	EphyEmbedNavigationFlags flags;
-	EphyHistoryItem *item;
+	WebKitWebHistoryItem *item;
+	WebKitWebView *web_view;
+	WebKitWebBackForwardList *web_back_forward_list;
 	gboolean up = FALSE, back = FALSE, forward = FALSE;
-	char *back_title = NULL, *forward_title = NULL;
+	const char *back_title = NULL, *forward_title = NULL;
 
 	if (window->priv->closing) return;
 
@@ -1639,29 +1642,26 @@
 	ephy_toolbar_set_navigation_actions (window->priv->toolbar,
 					     back, forward, up);
 
-	item = ephy_embed_get_previous_history_item (embed);
+	web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+	web_back_forward_list = webkit_web_view_get_back_forward_list (web_view);
+
+	item = webkit_web_back_forward_list_get_back_item (web_back_forward_list);
 
 	if (item)
 	{
-		back_title = ephy_history_item_get_title (item);
-		g_object_unref (item);
+		back_title = webkit_web_history_item_get_title (item);
 	}
 
-
-	item = ephy_embed_get_next_history_item (embed);
+	item = webkit_web_back_forward_list_get_forward_item (web_back_forward_list);
 
 	if (item)
 	{
-		forward_title = ephy_history_item_get_title (item);
-		g_object_unref (item);
+		forward_title = webkit_web_history_item_get_title (item);
 	}
 
 	ephy_toolbar_set_navigation_tooltips (window->priv->toolbar,
 					      back_title,
 					      forward_title);
-
-	g_free (back_title);
-	g_free (forward_title);
 }
 
 static void



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