diff options
author | Xan Lopez <xan@gnome.org> | 2009-09-07 20:28:28 +0800 |
---|---|---|
committer | Xan Lopez <xan@gnome.org> | 2009-09-07 20:31:04 +0800 |
commit | 7d58850eb100ff84bb2fe3f48658e01f64bb088c (patch) | |
tree | ff3e0aa65c9225039d3a2c9799fd41d575d25db3 | |
parent | 108eade49982245d1ffcf30159707554cdb63d69 (diff) | |
download | gsoc2013-epiphany-7d58850eb100ff84bb2fe3f48658e01f64bb088c.tar gsoc2013-epiphany-7d58850eb100ff84bb2fe3f48658e01f64bb088c.tar.gz gsoc2013-epiphany-7d58850eb100ff84bb2fe3f48658e01f64bb088c.tar.bz2 gsoc2013-epiphany-7d58850eb100ff84bb2fe3f48658e01f64bb088c.tar.lz gsoc2013-epiphany-7d58850eb100ff84bb2fe3f48658e01f64bb088c.tar.xz gsoc2013-epiphany-7d58850eb100ff84bb2fe3f48658e01f64bb088c.tar.zst gsoc2013-epiphany-7d58850eb100ff84bb2fe3f48658e01f64bb088c.zip |
Simplify EXPIRE logic in ephy_web_view_set_typed_address
The whole thing just had one functionality at this point as far as I
can see: prevent the typed address from being wiped out when a page
is loading. Simplify the code to do just that.
-rw-r--r-- | embed/ephy-web-view.c | 29 | ||||
-rw-r--r-- | embed/ephy-web-view.h | 10 | ||||
-rw-r--r-- | src/ephy-lockdown.c | 3 | ||||
-rw-r--r-- | src/ephy-shell.c | 3 | ||||
-rw-r--r-- | src/ephy-toolbar.c | 3 |
5 files changed, 16 insertions, 32 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 49fc653d5..499fb86f1 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -54,7 +54,6 @@ static void ephy_web_view_init (EphyWebView *gs); #define EMPTY_PAGE _("Blank page") /* Title for the empty page */ struct _EphyWebViewPrivate { - EphyWebViewAddressExpire address_expire; EphyWebViewSecurityLevel security_level; EphyWebViewDocumentType document_type; EphyWebViewNavigationFlags nav_flags; @@ -72,6 +71,7 @@ struct _EphyWebViewPrivate { char *link_message; char *icon_address; GdkPixbuf *icon; + gboolean expire_address_now; /* File watch */ GFileMonitor *monitor; @@ -441,8 +441,7 @@ ephy_web_view_set_property (GObject *object, ephy_web_view_set_popups_allowed (EPHY_WEB_VIEW (object), g_value_get_boolean (value)); break; case PROP_TYPED_ADDRESS: - ephy_web_view_set_typed_address (EPHY_WEB_VIEW (object), g_value_get_string (value), - EPHY_WEB_VIEW_ADDRESS_EXPIRE_NOW); + ephy_web_view_set_typed_address (EPHY_WEB_VIEW (object), g_value_get_string (value)); break; break; case PROP_ADDRESS: @@ -1011,7 +1010,7 @@ ephy_web_view_init (EphyWebView *web_view) priv = web_view->priv = EPHY_WEB_VIEW_GET_PRIVATE (web_view); - priv->address_expire = EPHY_WEB_VIEW_ADDRESS_EXPIRE_NOW; + priv->expire_address_now = TRUE; priv->is_blank = TRUE; priv->load_status = WEBKIT_LOAD_PROVISIONAL; priv->title = g_strdup (EMPTY_PAGE); @@ -1198,7 +1197,7 @@ ephy_web_view_set_address (EphyWebView *view, strcmp (address, "about:blank") == 0; if (ephy_web_view_is_loading (view) && - priv->address_expire == EPHY_WEB_VIEW_ADDRESS_EXPIRE_NOW && + priv->expire_address_now == TRUE && priv->typed_address != NULL) { g_free (priv->typed_address); priv->typed_address = NULL; @@ -1293,7 +1292,7 @@ ensure_page_info (EphyWebView *view, const char *address) EphyWebViewPrivate *priv = view->priv; if ((priv->address == NULL || priv->address[0] == '\0') && - priv->address_expire == EPHY_WEB_VIEW_ADDRESS_EXPIRE_NOW) { + priv->expire_address_now == TRUE) { ephy_web_view_set_address (view, address); } @@ -1404,7 +1403,7 @@ ephy_web_view_update_from_net_state (EphyWebView *view, g_free (priv->loading_title); priv->loading_title = NULL; - priv->address_expire = EPHY_WEB_VIEW_ADDRESS_EXPIRE_NOW; + priv->expire_address_now = TRUE; g_object_notify (object, "embed-title"); @@ -1909,27 +1908,23 @@ ephy_web_view_get_typed_address (EphyWebView *view) * ephy_web_view_set_typed_address: * @view: an #EphyWebView * @address: the new typed address, or %NULL to clear it - * @expire: when to expire this address_expire * * Sets the text that @view's #EphyWindow will display in its location toolbar * entry when @view is selected. **/ void ephy_web_view_set_typed_address (EphyWebView *view, - const char *address, - EphyWebViewAddressExpire expire) + const char *address) { EphyWebViewPrivate *priv = EPHY_WEB_VIEW (view)->priv; g_free (priv->typed_address); priv->typed_address = g_strdup (address); - - if (expire == EPHY_WEB_VIEW_ADDRESS_EXPIRE_CURRENT && - !ephy_web_view_is_loading (view)) { - priv->address_expire = EPHY_WEB_VIEW_ADDRESS_EXPIRE_NOW; - } else { - priv->address_expire = expire; - } + /* 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"); } diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h index dd92b9d5d..d50bf4fa1 100644 --- a/embed/ephy-web-view.h +++ b/embed/ephy-web-view.h @@ -108,13 +108,6 @@ typedef enum EPHY_WEB_VIEW_DOCUMENT_OTHER } EphyWebViewDocumentType; -typedef enum -{ - EPHY_WEB_VIEW_ADDRESS_EXPIRE_NOW, - EPHY_WEB_VIEW_ADDRESS_EXPIRE_NEXT, - EPHY_WEB_VIEW_ADDRESS_EXPIRE_CURRENT -} EphyWebViewAddressExpire; - struct _EphyWebView { WebKitWebView parent; @@ -195,8 +188,7 @@ void ephy_web_view_set_visibility (EphyWebView gboolean visibility); const char * ephy_web_view_get_typed_address (EphyWebView *view); void ephy_web_view_set_typed_address (EphyWebView *view, - const char *address, - EphyWebViewAddressExpire expire); + const char *address); gboolean ephy_web_view_get_is_blank (EphyWebView *view); gboolean ephy_web_view_has_modified_forms (EphyWebView *view); char * ephy_web_view_get_location (EphyWebView *view, diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c index 98627e722..f11d7b086 100644 --- a/src/ephy-lockdown.c +++ b/src/ephy-lockdown.c @@ -106,8 +106,7 @@ update_location_editable (EphyWindow *window, { address = ephy_web_view_get_location (EPHY_GET_EPHY_WEB_VIEW_FROM_EMBED (embed), TRUE); ephy_toolbar_set_location (EPHY_TOOLBAR (toolbar), address, NULL); - ephy_web_view_set_typed_address (EPHY_GET_EPHY_WEB_VIEW_FROM_EMBED (embed), NULL, - EPHY_WEB_VIEW_ADDRESS_EXPIRE_CURRENT); + ephy_web_view_set_typed_address (EPHY_GET_EPHY_WEB_VIEW_FROM_EMBED (embed), NULL); g_free (address); } } diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 0d37e609f..38c0c1a69 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -515,8 +515,7 @@ ephy_shell_new_tab_full (EphyShell *shell, if (flags & EPHY_NEW_TAB_HOME_PAGE || flags & EPHY_NEW_TAB_NEW_PAGE) { - ephy_web_view_set_typed_address (EPHY_GET_EPHY_WEB_VIEW_FROM_EMBED (embed), "", - EPHY_WEB_VIEW_ADDRESS_EXPIRE_NEXT); + ephy_web_view_set_typed_address (EPHY_GET_EPHY_WEB_VIEW_FROM_EMBED (embed), ""); ephy_toolbar_activate_location (toolbar); is_empty = load_homepage (embed); } diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c index e91b8ed62..61a34fccc 100644 --- a/src/ephy-toolbar.c +++ b/src/ephy-toolbar.c @@ -183,8 +183,7 @@ sync_user_input_cb (EphyLocationAction *action, address = ephy_location_action_get_address (action); priv->updating_address = TRUE; - ephy_web_view_set_typed_address (EPHY_GET_EPHY_WEB_VIEW_FROM_EMBED (embed), address, - EPHY_WEB_VIEW_ADDRESS_EXPIRE_CURRENT); + ephy_web_view_set_typed_address (EPHY_GET_EPHY_WEB_VIEW_FROM_EMBED (embed), address); priv->updating_address = FALSE; } |