diff options
author | Xan Lopez <xan@igalia.com> | 2012-02-29 23:35:32 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2012-03-07 04:49:44 +0800 |
commit | 92dec4e47d68bfb77be9ff256fcf44d1407d4ef4 (patch) | |
tree | ce2d1e7a37a200d7ca714761c4a44685d11f594f /embed | |
parent | 8ad6302a3f9e1a867f3dd61605196d22e9bd2f86 (diff) | |
download | gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.tar gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.tar.gz gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.tar.bz2 gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.tar.lz gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.tar.xz gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.tar.zst gsoc2013-epiphany-92dec4e47d68bfb77be9ff256fcf44d1407d4ef4.zip |
Store zoom levels per host, not per URL
Zoom levels have always been stored per host in Epiphany, not per URL
(otherwise you'd have to re-apply the zoom level again and again when
visiting, say, every news entry in your favorite newspaper). Change
things to work like that.
Note: this changes the SQL table format for the history, so you'll
need to re-migrate your history.
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-browse-history.c | 21 | ||||
-rw-r--r-- | embed/ephy-browse-history.h | 5 | ||||
-rw-r--r-- | embed/ephy-embed.c | 23 |
3 files changed, 32 insertions, 17 deletions
diff --git a/embed/ephy-browse-history.c b/embed/ephy-browse-history.c index c58eaeaf7..45d0d1c4e 100644 --- a/embed/ephy-browse-history.c +++ b/embed/ephy-browse-history.c @@ -158,11 +158,10 @@ ephy_browse_history_set_page_zoom_level (EphyBrowseHistory *history, g_return_if_fail (EPHY_IS_BROWSE_HISTORY (history)); g_return_if_fail (url != NULL); - ephy_history_service_set_url_property (history->priv->history_service, - url, - EPHY_HISTORY_URL_ZOOM_LEVEL, - g_variant_new_double (zoom_level), - NULL, NULL); + ephy_history_service_set_url_zoom_level (history->priv->history_service, + url, + zoom_level, + NULL, NULL); } void @@ -214,3 +213,15 @@ ephy_browse_history_delete_urls (EphyBrowseHistory *history, ephy_history_service_delete_urls (history->priv->history_service, urls, callback, user_data); } + +void +ephy_browse_history_get_host_for_url (EphyBrowseHistory *history, + const char *url, + EphyHistoryJobCallback callback, + gpointer user_data) +{ + g_return_if_fail (EPHY_IS_BROWSE_HISTORY (history)); + + ephy_history_service_get_host_for_url (history->priv->history_service, + url, callback, user_data); +} diff --git a/embed/ephy-browse-history.h b/embed/ephy-browse-history.h index 980134af5..1acc97b7e 100644 --- a/embed/ephy-browse-history.h +++ b/embed/ephy-browse-history.h @@ -103,6 +103,11 @@ void ephy_browse_history_delete_urls (EphyBrowseHistory *history, EphyHistoryJobCallback callback, gpointer user_data); +void ephy_browse_history_get_host_for_url (EphyBrowseHistory *history, + const char *url, + EphyHistoryJobCallback callback, + gpointer user_data); + G_END_DECLS #endif /* _EPHY_BROWSE_HISTORY_H */ diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 49a2e1568..b9f1f46d6 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -230,12 +230,12 @@ ephy_embed_statusbar_pop (EphyEmbed *embed, guint context_id) } static void -get_url_for_zoom_cb (gpointer service, +get_host_for_url_cb (gpointer service, gboolean success, gpointer result_data, gpointer user_data) { - EphyHistoryURL *url; + EphyHistoryHost *host; EphyEmbed *embed; WebKitWebView *web_view; double current_zoom; @@ -244,22 +244,21 @@ get_url_for_zoom_cb (gpointer service, return; embed = EPHY_EMBED (user_data); - url = (EphyHistoryURL *) result_data; - - g_assert (url != NULL); + host = (EphyHistoryHost *)result_data; web_view = embed->priv->web_view; - g_object_get (web_view, "zoom-level", ¤t_zoom, + g_object_get (web_view, + "zoom-level", ¤t_zoom, NULL); - if (url->zoom_level != current_zoom) { + if (host->zoom_level != current_zoom) { embed->priv->is_setting_zoom = TRUE; - g_object_set (web_view, "zoom-level", url->zoom_level, NULL); + g_object_set (web_view, "zoom-level", host->zoom_level, NULL); embed->priv->is_setting_zoom = FALSE; } - ephy_history_url_free (url); + ephy_history_host_free (host); } static void @@ -268,9 +267,9 @@ restore_zoom_level (EphyEmbed *embed, { /* restore zoom level */ if (ephy_embed_utils_address_has_web_scheme (address)) { - ephy_browse_history_get_url (embed->priv->browse_history, - address, - (EphyHistoryJobCallback)get_url_for_zoom_cb, embed); + ephy_browse_history_get_host_for_url (embed->priv->browse_history, + address, + (EphyHistoryJobCallback)get_host_for_url_cb, embed); } } |