aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2011-08-26 19:45:06 +0800
committerXan Lopez <xan@igalia.com>2012-03-07 04:49:43 +0800
commit196110fbed5da6e94c232e1f3b8648aa689f7a79 (patch)
tree0fafe7058b7663a6c49e911a092182adf8eed6af
parent446a84f8f5caf85055ae8bf3fdbf91f405888e68 (diff)
downloadgsoc2013-epiphany-196110fbed5da6e94c232e1f3b8648aa689f7a79.tar
gsoc2013-epiphany-196110fbed5da6e94c232e1f3b8648aa689f7a79.tar.gz
gsoc2013-epiphany-196110fbed5da6e94c232e1f3b8648aa689f7a79.tar.bz2
gsoc2013-epiphany-196110fbed5da6e94c232e1f3b8648aa689f7a79.tar.lz
gsoc2013-epiphany-196110fbed5da6e94c232e1f3b8648aa689f7a79.tar.xz
gsoc2013-epiphany-196110fbed5da6e94c232e1f3b8648aa689f7a79.tar.zst
gsoc2013-epiphany-196110fbed5da6e94c232e1f3b8648aa689f7a79.zip
Use EphyBrowseHistory to set/get the zoom level for pages
-rw-r--r--embed/ephy-embed.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 68e0e9833..49a2e1568 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -37,6 +37,7 @@
#include "ephy-file-helpers.h"
#include "ephy-history.h"
#include "ephy-browse-history.h"
+#include "ephy-history-types.h"
#include "ephy-prefs.h"
#include "ephy-settings.h"
#include "ephy-string.h"
@@ -229,39 +230,47 @@ ephy_embed_statusbar_pop (EphyEmbed *embed, guint context_id)
}
static void
-restore_zoom_level (EphyEmbed *embed,
- const char *address)
+get_url_for_zoom_cb (gpointer service,
+ gboolean success,
+ gpointer result_data,
+ gpointer user_data)
{
- EphyEmbedPrivate *priv = embed->priv;
+ EphyHistoryURL *url;
+ EphyEmbed *embed;
+ WebKitWebView *web_view;
+ double current_zoom;
- /* restore zoom level */
- if (ephy_embed_utils_address_has_web_scheme (address)) {
- EphyHistory *history;
- EphyNode *host;
- WebKitWebView *web_view;
- GValue value = { 0, };
- float zoom = 1.0, current_zoom;
-
- history = EPHY_HISTORY
- (ephy_embed_shell_get_global_history (embed_shell));
- host = ephy_history_get_host (history, address);
-
- if (host != NULL && ephy_node_get_property
- (host, EPHY_NODE_HOST_PROP_ZOOM, &value)) {
- zoom = g_value_get_float (&value);
- g_value_unset (&value);
- }
+ if (success == FALSE)
+ return;
- web_view = priv->web_view;
+ embed = EPHY_EMBED (user_data);
+ url = (EphyHistoryURL *) result_data;
- g_object_get (web_view, "zoom-level", &current_zoom,
- NULL);
+ g_assert (url != NULL);
- if (zoom != current_zoom) {
- priv->is_setting_zoom = TRUE;
- g_object_set (web_view, "zoom-level", zoom, NULL);
- priv->is_setting_zoom = FALSE;
- }
+ web_view = embed->priv->web_view;
+
+ g_object_get (web_view, "zoom-level", &current_zoom,
+ NULL);
+
+ if (url->zoom_level != current_zoom) {
+ embed->priv->is_setting_zoom = TRUE;
+ g_object_set (web_view, "zoom-level", url->zoom_level, NULL);
+ embed->priv->is_setting_zoom = FALSE;
+ }
+
+ ephy_history_url_free (url);
+}
+
+static void
+restore_zoom_level (EphyEmbed *embed,
+ const char *address)
+{
+ /* 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);
}
}
@@ -344,17 +353,8 @@ zoom_changed_cb (WebKitWebView *web_view,
address = ephy_web_view_get_location (EPHY_WEB_VIEW (web_view), TRUE);
if (ephy_embed_utils_address_has_web_scheme (address)) {
- EphyHistory *history;
- EphyNode *host;
- history = EPHY_HISTORY
- (ephy_embed_shell_get_global_history (embed_shell));
- host = ephy_history_get_host (history, address);
-
- if (host != NULL) {
- ephy_node_set_property_float (host,
- EPHY_NODE_HOST_PROP_ZOOM,
- zoom);
- }
+ ephy_browse_history_set_page_zoom_level (embed->priv->browse_history,
+ address, zoom);
}
g_free (address);