[epiphany/history-rewrite] Use EphyBrowseHistory to set/get the zoom level for pages
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/history-rewrite] Use EphyBrowseHistory to set/get the zoom level for pages
- Date: Thu, 1 Sep 2011 16:47:44 +0000 (UTC)
commit 953e16d3fd58f600c0b76e319d3fef09ef1b06e3
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 9589182..19dd5ce 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-stock-icons.h"
@@ -94,39 +95,47 @@ struct _EphyEmbedPrivate
G_DEFINE_TYPE (EphyEmbed, ephy_embed, GTK_TYPE_BOX)
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);
}
}
@@ -209,17 +218,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]