[epiphany] Use WebKitWebView API to get/set the zoom level instead of g_object_get/set
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Use WebKitWebView API to get/set the zoom level instead of g_object_get/set
- Date: Thu, 21 Jun 2012 10:45:56 +0000 (UTC)
commit 32c03a55b26a95bebfbde11a167c4f563070d024
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Thu Jun 21 12:24:15 2012 +0200
Use WebKitWebView API to get/set the zoom level instead of g_object_get/set
Also use always double instead of float so that it will be compatible
with WebKit2 API.
embed/ephy-web-view.c | 12 ++++--------
src/ephy-window.c | 12 +++++-------
2 files changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 72da3ce..a3677e9 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1855,13 +1855,11 @@ get_host_for_url_cb (gpointer service,
view = EPHY_WEB_VIEW (user_data);
host = (EphyHistoryHost *)result_data;
- g_object_get (view,
- "zoom-level", ¤t_zoom,
- NULL);
+ current_zoom = webkit_web_view_get_zoom_level (WEBKIT_WEB_VIEW (view));
if (host->zoom_level != current_zoom) {
view->priv->is_setting_zoom = TRUE;
- g_object_set (view, "zoom-level", host->zoom_level, NULL);
+ webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW (view), host->zoom_level);
view->priv->is_setting_zoom = FALSE;
}
@@ -2254,12 +2252,10 @@ zoom_changed_cb (WebKitWebView *web_view,
gpointer user_data)
{
char *address;
- float zoom;
+ double zoom;
EphyWebViewPrivate *priv = EPHY_WEB_VIEW (web_view)->priv;
- g_object_get (web_view,
- "zoom-level", &zoom,
- NULL);
+ zoom = webkit_web_view_get_zoom_level (web_view);
if (priv->is_setting_zoom)
return;
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 292e958..544ff59 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1410,14 +1410,12 @@ sync_tab_zoom (WebKitWebView *web_view, GParamSpec *pspec, EphyWindow *window)
GtkAction *action;
EphyWebViewDocumentType type;
gboolean can_zoom_in = TRUE, can_zoom_out = TRUE, can_zoom_normal = FALSE, can_zoom;
- float zoom;
+ double zoom;
EphyEmbed *embed = window->priv->active_embed;
if (window->priv->closing) return;
- g_object_get (web_view,
- "zoom-level", &zoom,
- NULL);
+ zoom = webkit_web_view_get_zoom_level (web_view);
type = ephy_web_view_get_document_type (ephy_embed_get_web_view (embed));
can_zoom = (type != EPHY_WEB_VIEW_DOCUMENT_IMAGE);
@@ -3636,7 +3634,7 @@ ephy_window_set_zoom (EphyWindow *window,
float zoom)
{
EphyEmbed *embed;
- float current_zoom = 1.0;
+ double current_zoom = 1.0;
WebKitWebView *web_view;
g_return_if_fail (EPHY_IS_WINDOW (window));
@@ -3646,7 +3644,7 @@ ephy_window_set_zoom (EphyWindow *window,
web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
- g_object_get (web_view, "zoom-level", ¤t_zoom, NULL);
+ current_zoom = webkit_web_view_get_zoom_level (web_view);
if (zoom == ZOOM_IN)
{
@@ -3659,7 +3657,7 @@ ephy_window_set_zoom (EphyWindow *window,
if (zoom != current_zoom)
{
- g_object_set (G_OBJECT (web_view), "zoom-level", zoom, NULL);
+ webkit_web_view_set_zoom_level (web_view, zoom);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]