aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@gnome.org>2009-06-02 23:56:28 +0800
committerXan Lopez <xan@gnome.org>2009-06-03 00:08:50 +0800
commita62be2bb0ad051a60b99b02e39c58f96dd5b3b9e (patch)
treec551691573045b474c0cb894cc98ba4dbd5fc6bb
parent9f4b66ef75418ea4f51179432f4d5aeca4e586ed (diff)
downloadgsoc2013-epiphany-a62be2bb0ad051a60b99b02e39c58f96dd5b3b9e.tar.gz
gsoc2013-epiphany-a62be2bb0ad051a60b99b02e39c58f96dd5b3b9e.tar.zst
gsoc2013-epiphany-a62be2bb0ad051a60b99b02e39c58f96dd5b3b9e.zip
Move load_url method to EphyWebView.
-rw-r--r--embed/ephy-embed.c15
-rw-r--r--embed/ephy-embed.h5
-rw-r--r--embed/ephy-web-view.c17
-rw-r--r--embed/ephy-web-view.h3
-rw-r--r--embed/webkit/webkit-embed.c29
-rw-r--r--src/ephy-shell.c3
-rw-r--r--src/ephy-window.c4
-rw-r--r--src/epiphany.defs9
-rw-r--r--src/popup-commands.c8
9 files changed, 31 insertions, 62 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 04b94bba1..29ecfed9d 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -350,21 +350,6 @@ ephy_embed_base_init (gpointer g_class)
}
/**
- * ephy_embed_load_url:
- * @embed: an #EphyEmbed
- * @url: a URL
- *
- * Loads a new web page in @embed.
- **/
-void
-ephy_embed_load_url (EphyEmbed *embed,
- const char *url)
-{
- EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
- iface->load_url (embed, url);
-}
-
-/**
* ephy_embed_can_go_up:
* @embed: an #EphyEmbed
*
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index a974ae790..2f48763c4 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -154,8 +154,6 @@ struct _EphyEmbedIface
const char *uri);
/* Methods */
- void (* load_url) (EphyEmbed *embed,
- const char *url);
gboolean (* can_go_up) (EphyEmbed *embed);
GSList * (* get_go_up_list) (EphyEmbed *embed);
void (* go_up) (EphyEmbed *embed);
@@ -203,9 +201,6 @@ GType ephy_embed_document_type_get_type (void);
GType ephy_embed_get_type (void);
/* Base */
-void ephy_embed_load_url (EphyEmbed *embed,
- const char *url);
-
const char *ephy_embed_get_title (EphyEmbed *embed);
char *ephy_embed_get_location (EphyEmbed *embed,
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 7606e6d01..10e6d3475 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -77,6 +77,23 @@ ephy_web_view_load_request (EphyWebView *web_view,
}
/**
+ * ephy_web_view_load_url:
+ * @embed: an #EphyWebView
+ * @url: a URL
+ *
+ * Loads @url in @embed.
+ **/
+void
+ephy_web_view_load_url (EphyWebView *view,
+ const char *url)
+{
+ g_return_if_fail (EPHY_IS_WEB_VIEW (view));
+ g_return_if_fail (url);
+
+ webkit_web_view_open (WEBKIT_WEB_VIEW (view), url);
+}
+
+/**
* ephy_web_view_copy_back_history:
* @source: the #EphyWebView from which to get the back history
* @dest: the #EphyWebView to copy the history to
diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h
index 870b54c43..898133040 100644
--- a/embed/ephy-web-view.h
+++ b/embed/ephy-web-view.h
@@ -63,6 +63,9 @@ GtkWidget *ephy_web_view_new (void);
void ephy_web_view_load_request (EphyWebView *web_view,
WebKitNetworkRequest *request);
+void ephy_web_view_load_url (EphyWebView *web_view,
+ const char *url);
+
void ephy_web_view_copy_back_history (EphyWebView *source,
EphyWebView *dest);
diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c
index 8528759a9..c7e5f9f54 100644
--- a/embed/webkit/webkit-embed.c
+++ b/embed/webkit/webkit-embed.c
@@ -72,7 +72,6 @@ struct WebKitEmbedPrivate
WebKitWebView *web_view;
GtkScrolledWindow *scrolled_window;
WebKitEmbedLoadState load_state;
- char *loading_uri;
EphyHistory *history;
GtkWidget *inspector_window;
guint is_setting_zoom : 1;
@@ -150,6 +149,7 @@ static void
update_load_state (WebKitEmbed *embed, WebKitWebView *web_view)
{
EphyEmbedNetState estate = EPHY_EMBED_STATE_UNKNOWN;
+ const char *loading_uri = ephy_embed_get_typed_address (embed);
if (embed->priv->load_state == WEBKIT_EMBED_LOAD_STARTED)
{
@@ -159,7 +159,7 @@ update_load_state (WebKitEmbed *embed, WebKitWebView *web_view)
EPHY_EMBED_STATE_IS_REQUEST |
EPHY_EMBED_STATE_IS_NETWORK);
- g_signal_emit_by_name (embed, "new-document-now", embed->priv->loading_uri);
+ g_signal_emit_by_name (embed, "new-document-now", loading_uri);
}
if (embed->priv->load_state == WEBKIT_EMBED_LOAD_LOADING)
@@ -175,7 +175,7 @@ update_load_state (WebKitEmbed *embed, WebKitWebView *web_view)
EPHY_EMBED_STATE_IS_NETWORK);
ephy_base_embed_update_from_net_state (EPHY_BASE_EMBED (embed),
- embed->priv->loading_uri,
+ loading_uri,
(EphyEmbedNetState)estate);
}
@@ -326,23 +326,9 @@ zoom_changed_cb (WebKitWebView *web_view,
}
static void
-webkit_embed_finalize (GObject *object)
-{
- WebKitEmbed *wembed = WEBKIT_EMBED (object);
-
- g_free (wembed->priv->loading_uri);
-
- G_OBJECT_CLASS (webkit_embed_parent_class)->finalize (object);
-}
-
-static void
webkit_embed_class_init (WebKitEmbedClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = webkit_embed_finalize;
-
- g_type_class_add_private (object_class, sizeof(WebKitEmbedPrivate));
+ g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof(WebKitEmbedPrivate));
}
static WebKitWebView *
@@ -784,12 +770,6 @@ static void
impl_load_url (EphyEmbed *embed,
const char *url)
{
- WebKitEmbed *wembed = WEBKIT_EMBED (embed);
-
- g_free (wembed->priv->loading_uri);
- wembed->priv->loading_uri = g_strdup (url);
-
- webkit_web_view_open (wembed->priv->web_view, url);
}
static gboolean
@@ -872,7 +852,6 @@ impl_has_modified_forms (EphyEmbed *embed)
static void
ephy_embed_iface_init (EphyEmbedIface *iface)
{
- iface->load_url = impl_load_url;
iface->can_go_up = impl_can_go_up;
iface->get_go_up_list = impl_get_go_up_list;
iface->go_up = impl_go_up;
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index f9f11387e..0c013b804 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -396,8 +396,7 @@ load_homepage (EphyEmbed *embed)
}
is_empty = url_is_empty (home);
-
- ephy_embed_load_url (embed, home);
+ ephy_web_view_load_url (EPHY_WEB_VIEW (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed)), home);
g_free (home);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 3f0c4f497..2df66b244 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -3598,7 +3598,7 @@ ephy_window_open_link (EphyLink *link,
}
else
{
- ephy_embed_load_url (embed, address);
+ ephy_web_view_load_url (EPHY_WEB_VIEW (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed)), address);
if (address == NULL || address[0] == '\0' || strcmp (address, "about:blank") == 0)
{
@@ -3990,7 +3990,7 @@ real_get_active_tab (EphyWindow *window, int page_num)
* @url: the url to load
*
* Loads a new url in the active tab of @window.
- * Unlike ephy_embed_load_url(), this function activates
+ * Unlike ephy_web_view_load_url(), this function activates
* the embed.
*
**/
diff --git a/src/epiphany.defs b/src/epiphany.defs
index b0c439fe5..8465d3a28 100644
--- a/src/epiphany.defs
+++ b/src/epiphany.defs
@@ -951,15 +951,6 @@
(return-type "GType")
)
-(define-method load_url
- (of-object "EphyEmbed")
- (c-name "ephy_embed_load_url")
- (return-type "none")
- (parameters
- '("const-char*" "url")
- )
-)
-
(define-method get_title
(of-object "EphyEmbed")
(c-name "ephy_embed_get_title")
diff --git a/src/popup-commands.c b/src/popup-commands.c
index 503e6cc4f..31203237e 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -25,10 +25,12 @@
#include "ephy-embed-container.h"
#include "ephy-embed-factory.h"
#include "ephy-embed-persist.h"
+#include "ephy-embed-utils.h"
#include "ephy-prefs.h"
#include "eel-gconf-extensions.h"
#include "ephy-file-helpers.h"
#include "ephy-bookmarks-ui.h"
+#include "ephy-web-view.h"
#include <string.h>
#include <glib/gi18n.h>
@@ -248,8 +250,7 @@ popup_cmd_open_link (GtkAction *action,
event = ephy_window_get_context_event (window);
value = ephy_embed_event_get_property (event, "link");
location = g_value_get_string (value);
-
- ephy_embed_load_url (embed, location);
+ ephy_web_view_load_url (EPHY_WEB_VIEW (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed)), location);
}
void
@@ -373,8 +374,7 @@ popup_cmd_open_frame (GtkAction *action,
g_return_if_fail (embed != NULL);
location = ephy_embed_get_location (embed, FALSE);
-
- ephy_embed_load_url (embed, location);
+ ephy_web_view_load_url (EPHY_WEB_VIEW (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed)), location);
g_free (location);
}