From 76dd77e2f40b6e2de50716117c3abd2c49e528a4 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Mon, 30 Jun 2008 21:27:12 +0000 Subject: embed: remove ge-zoom-changed and zoom property. Use zoom-level property in WebKit directly. svn path=/trunk/; revision=8326 --- embed/ephy-base-embed.c | 58 +++------------------------------------------ embed/ephy-embed.c | 21 ---------------- embed/ephy-embed.h | 2 -- embed/webkit/webkit-embed.c | 45 ++++++++++++++++++++++++++++++++++- 4 files changed, 47 insertions(+), 79 deletions(-) (limited to 'embed') diff --git a/embed/ephy-base-embed.c b/embed/ephy-base-embed.c index 68bae0683..689cf80de 100644 --- a/embed/ephy-base-embed.c +++ b/embed/ephy-base-embed.c @@ -55,7 +55,6 @@ struct _EphyBaseEmbedPrivate { /* guint security_level : 3; ? */ EphyEmbedDocumentType document_type; EphyEmbedNavigationFlags nav_flags; - float zoom; /* Flags */ guint is_blank : 1; @@ -108,7 +107,6 @@ enum { PROP_TITLE, PROP_VISIBLE, PROP_TYPED_ADDRESS, - PROP_ZOOM }; #define EPHY_BASE_EMBED_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_BASE_EMBED, EphyBaseEmbedPrivate)) @@ -480,7 +478,6 @@ ephy_base_embed_set_property (GObject *object, case PROP_SECURITY: case PROP_STATUS_MESSAGE: case PROP_VISIBLE: - case PROP_ZOOM: /* read only */ break; default: @@ -584,9 +581,6 @@ ephy_base_embed_get_property (GObject *object, case PROP_VISIBLE: g_value_set_boolean (value, priv->visibility); break; - case PROP_ZOOM: - g_value_set_float (value, priv->zoom); - break; default: break; } @@ -623,15 +617,7 @@ ephy_base_embed_class_init (EphyBaseEmbedClass *klass) EPHY_TYPE_EMBED_DOCUMENT_TYPE, EPHY_EMBED_DOCUMENT_HTML, G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - g_object_class_install_property (gobject_class, - PROP_ZOOM, - g_param_spec_float ("zoom", - "Zoom", - "The embed's zoom", - ZOOM_MINIMAL, - ZOOM_MAXIMAL, - 1.0, - G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); + g_object_class_install_property (gobject_class, PROP_LOAD_PROGRESS, g_param_spec_int ("load-progress", @@ -765,41 +751,6 @@ ge_document_type_cb (EphyEmbed *embed, } } -static void -ge_zoom_change_cb (EphyEmbed *embed, - float zoom, - EphyBaseEmbed *bembed) -{ - char *address; - - if (bembed->priv->zoom != zoom) { - if (bembed->priv->is_setting_zoom) { - return; - } - - address = ephy_embed_get_location (embed, 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); - } - } - - g_free (address); - - bembed->priv->zoom = zoom; - - g_object_notify (G_OBJECT (embed), "zoom"); - } -} - static void ge_favicon_cb (EphyEmbed *membed, const char *address, @@ -894,10 +845,6 @@ ephy_base_embed_init (EphyBaseEmbed *self) G_CALLBACK (ge_document_type_cb), self, (GConnectFlags)0); - g_signal_connect_object (self, "ge_zoom_change", - G_CALLBACK (ge_zoom_change_cb), - self, (GConnectFlags)0); - g_signal_connect_object (self, "ge_favicon", G_CALLBACK (ge_favicon_cb), self, (GConnectFlags)0); @@ -918,7 +865,6 @@ ephy_base_embed_init (EphyBaseEmbed *self) priv->document_type = EPHY_EMBED_DOCUMENT_HTML; priv->security_level = EPHY_EMBED_STATE_IS_UNKNOWN; - priv->zoom = 1.0; priv->address_expire = EPHY_EMBED_ADDRESS_EXPIRE_NOW; priv->is_blank = TRUE; priv->title = g_strdup (EMPTY_PAGE); @@ -1546,6 +1492,7 @@ ephy_base_embed_set_security_level (EphyBaseEmbed *embed, } } +#if 0 void ephy_base_embed_restore_zoom_level (EphyBaseEmbed *membed, const char *address) @@ -1577,6 +1524,7 @@ ephy_base_embed_restore_zoom_level (EphyBaseEmbed *membed, } } } +#endif void ephy_base_embed_set_visibility (EphyBaseEmbed *embed, diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 5fff25366..2260b112d 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -207,27 +207,6 @@ ephy_embed_base_init (gpointer g_class) G_TYPE_BOOLEAN, 1, G_TYPE_OBJECT); -/** - * EphyEmbed::ge-zoom-change: - * @embed: - * @zoom: @embed's new zoom level - * - * The ::ge_zoom_change signal is emitted when @embed's zoom changes. This can - * be manual (the user modified the zoom level) or automatic (@embed's zoom is - * automatically changed when browsing to a new site for which the user - * previously specified a zoom level). - * - * A @zoom value of 1.0 indicates 100% (normal zoom). - **/ - g_signal_new ("ge_zoom_change", - EPHY_TYPE_EMBED, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EphyEmbedIface, zoom_change), - NULL, NULL, - g_cclosure_marshal_VOID__FLOAT, - G_TYPE_NONE, - 1, - G_TYPE_FLOAT); /** * EphyEmbed::ge-modal-alert: * @embed: diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h index 6df34e8d1..8a03b501b 100644 --- a/embed/ephy-embed.h +++ b/embed/ephy-embed.h @@ -145,8 +145,6 @@ struct _EphyEmbedIface const char *address, const char *target, const char *features); - void (* zoom_change) (EphyEmbed *embed, - float new_zoom); void (* content_blocked) (EphyEmbed *embed, const char *uri); gboolean (* modal_alert) (EphyEmbed *embed); diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c index c59d0b493..4d483844a 100644 --- a/embed/webkit/webkit-embed.c +++ b/embed/webkit/webkit-embed.c @@ -28,6 +28,7 @@ #include "ephy-embed-single.h" #include "ephy-string.h" #include "ephy-embed-event.h" +#include "ephy-embed-utils.h" #include #include @@ -213,6 +214,46 @@ webkit_embed_hovering_over_link_cb (WebKitWebView *web_view, ephy_base_embed_set_link_message (EPHY_BASE_EMBED (embed), location); } +static void +webkit_web_view_zoom_change_cb (WebKitWebView *web_view, + GParamSpec *pspec, + EphyEmbed *embed) +{ + char *address; + float zoom; + + g_object_get (G_OBJECT (web_view), + "zoom-level", &zoom, + NULL); + + /* TODO: need to move the is_setting_zoom flag + * somewhere else. It's set by restoring_zoom + * in base_embed, which is unused right now. Should + * be called each time we load a page in a web_view + + if (bembed->priv->is_setting_zoom) { + return; + } + */ + + address = ephy_embed_get_location (embed, 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); + } + } + + g_free (address); +} + static void webkit_embed_finalize (GObject *object) { @@ -263,6 +304,9 @@ webkit_embed_init (WebKitEmbed *embed) "signal::hovering-over-link", G_CALLBACK (webkit_embed_hovering_over_link_cb), embed, NULL); + g_signal_connect (G_OBJECT (web_view), + "notify::zoom-level", G_CALLBACK (webkit_web_view_zoom_change_cb), embed); + webkit_embed_prefs_add_embed (embed); embed->priv->history = EPHY_HISTORY (ephy_embed_shell_get_global_history (ephy_embed_shell_get_default ())); @@ -354,7 +398,6 @@ impl_set_zoom (EphyEmbed *embed, g_return_if_fail (zoom > 0.0); g_object_set (WEBKIT_EMBED (embed)->priv->web_view, "zoom-level", zoom, NULL); - g_signal_emit_by_name (embed, "ge_zoom_change", zoom); } static void -- cgit v1.2.3