[epiphany] Use EphyBrowseHistory to set/get the zoom level for pages
- From: Xan Lopez <xan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Use EphyBrowseHistory to set/get the zoom level for pages
- Date: Tue, 6 Mar 2012 20:51:16 +0000 (UTC)
commit 196110fbed5da6e94c232e1f3b8648aa689f7a79
Author: Claudio Saavedra <csaavedra igalia com>
Date: Fri Aug 26 14:45:06 2011 +0300
Use EphyBrowseHistory to set/get the zoom level for pages
embed/ephy-embed.c | 78 ++++++++++++++++++++++++++--------------------------
1 files changed, 39 insertions(+), 39 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 68e0e98..49a2e15 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", ¤t_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", ¤t_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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]