aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-06-28 17:55:14 +0800
committerXan Lopez <xan@igalia.com>2012-06-28 17:55:14 +0800
commit8797404133cf7c578c29de82ccf37040348170df (patch)
tree01b623cd136389e8baec0d42647a2fd5c2f1b012 /embed
parentde2aeeb64480a4dab6ef907dc581f7770672bf2e (diff)
downloadgsoc2013-epiphany-8797404133cf7c578c29de82ccf37040348170df.tar
gsoc2013-epiphany-8797404133cf7c578c29de82ccf37040348170df.tar.gz
gsoc2013-epiphany-8797404133cf7c578c29de82ccf37040348170df.tar.bz2
gsoc2013-epiphany-8797404133cf7c578c29de82ccf37040348170df.tar.lz
gsoc2013-epiphany-8797404133cf7c578c29de82ccf37040348170df.tar.xz
gsoc2013-epiphany-8797404133cf7c578c29de82ccf37040348170df.tar.zst
gsoc2013-epiphany-8797404133cf7c578c29de82ccf37040348170df.zip
ephy-web-view: try to simplify a bit the typed-address logic
I think we can do without the "expire_address_now" boolean, and just rely on whether typed-address itself is NULL or not. If it is not, we want to always show it in the location entry and never overwrite it, since it reflects what the user has typed. The only case when we want to go ahead and set it to NULL is when the load actually starts (ie, when the user wants to transform what he has typed into a new load). Try to document things better reflecting this logic.
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-web-view.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 5bf4e3564..c2e8572ae 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -88,7 +88,6 @@ struct _EphyWebViewPrivate {
char *status_message;
char *link_message;
GdkPixbuf *icon;
- gboolean expire_address_now;
/* Local file watch. */
EphyFileMonitor *file_monitor;
@@ -2019,8 +2018,7 @@ load_changed_cb (WebKitWebView *web_view,
loading_uri = webkit_web_view_get_uri (web_view);
g_signal_emit_by_name (view, "new-document-now", loading_uri);
- if ((priv->address == NULL || priv->address[0] == '\0') &&
- priv->expire_address_now == TRUE) {
+ if (priv->address == NULL || priv->address[0] == '\0') {
ephy_web_view_set_address (view, loading_uri);
ephy_web_view_set_title (view, NULL);
}
@@ -2031,7 +2029,6 @@ load_changed_cb (WebKitWebView *web_view,
priv->status_message = g_strdup (priv->loading_title);
g_object_notify (object, "status-message");
- priv->expire_address_now = TRUE;
break;
}
case WEBKIT_LOAD_REDIRECTED:
@@ -2187,8 +2184,7 @@ load_status_cb (WebKitWebView *web_view,
g_signal_emit_by_name (view, "new-document-now", loading_uri);
- if ((priv->address == NULL || priv->address[0] == '\0') &&
- priv->expire_address_now == TRUE) {
+ if (priv->address == NULL || priv->address[0] == '\0') {
ephy_web_view_set_address (view, loading_uri);
ephy_web_view_set_title (view, NULL);
}
@@ -2199,7 +2195,6 @@ load_status_cb (WebKitWebView *web_view,
priv->status_message = g_strdup (priv->loading_title);
g_object_notify (object, "status-message");
- priv->expire_address_now = TRUE;
break;
}
case WEBKIT_LOAD_COMMITTED: {
@@ -2519,12 +2514,10 @@ load_error_cb (WebKitWebView *web_view,
{
EphyWebViewPrivate *priv = view->priv;
- if (priv->expire_address_now) {
+ if (!priv->typed_address) {
const char* prev_uri;
prev_uri = webkit_web_view_get_uri (web_view);
-
- ephy_web_view_set_typed_address (view, NULL);
ephy_web_view_set_address (view, prev_uri);
}
}
@@ -2639,7 +2632,6 @@ ephy_web_view_init (EphyWebView *web_view)
priv = web_view->priv = EPHY_WEB_VIEW_GET_PRIVATE (web_view);
- priv->expire_address_now = TRUE;
priv->is_blank = TRUE;
#ifndef HAVE_WEBKIT2
priv->load_status = WEBKIT_LOAD_PROVISIONAL;
@@ -3066,7 +3058,6 @@ ephy_web_view_set_address (EphyWebView *view,
_ephy_web_view_set_is_blank (view, is_blank);
if (ephy_web_view_is_loading (view) &&
- priv->expire_address_now == TRUE &&
priv->typed_address != NULL) {
g_free (priv->typed_address);
priv->typed_address = NULL;
@@ -3480,15 +3471,23 @@ ephy_web_view_set_visibility (EphyWebView *view,
* ephy_web_view_get_typed_address:
* @view: an #EphyWebView
*
- * Returns the text that @view's #EphyWindow will display in its location toolbar
- * entry when @view is selected.
+ * Returns the text that the user introduced in the @view's
+ * #EphyWindow location entry, if any.
*
* This is not guaranteed to be the same as @view's location,
- * available through ephy_web_view_get_location(). As the user types a new address
- * into the location entry, ephy_web_view_get_location()'s returned string will
- * change.
+ * available through ephy_web_view_get_location(). As the user types a
+ * new address into the location entry,
+ * ephy_web_view_get_typed_address()'s returned string will
+ * change. When the load starts, ephy_web_view_get_typed_address()
+ * will return %NULL, and ephy_web_view_get_location() will return the
+ * new page being loaded. Note that the typed_address can be changed
+ * again while a load is in progress (in case the user starts to type
+ * again in the location entry); in that case
+ * ephy_web_view_get_typed_address() will be again non-%NULL, and the
+ * contents of the entry will not be overwritten.
*
- * Return value: @view's #EphyWindow's location entry text when @view is selected
+ * Return value: @view's #EphyWindow's location entry text when @view
+ * is selected.
**/
const char *
ephy_web_view_get_typed_address (EphyWebView *view)
@@ -3512,11 +3511,6 @@ ephy_web_view_set_typed_address (EphyWebView *view,
g_free (priv->typed_address);
priv->typed_address = g_strdup (address);
- /* If the page is loading prevent the typed address from going away,
- since Epiphany will try to overwrite the typed address with the
- confirmed full URL when passing through, for example, the
- COMMITTED state. */
- priv->expire_address_now = !ephy_web_view_is_loading (view);
g_object_notify (G_OBJECT (view), "typed-address");
}