epiphany r8326 - in trunk: doc/reference/tmpl embed embed/webkit src



Author: xan
Date: Mon Jun 30 21:27:12 2008
New Revision: 8326
URL: http://svn.gnome.org/viewvc/epiphany?rev=8326&view=rev

Log:
embed: remove ge-zoom-changed and zoom property.

Use zoom-level property in WebKit directly.


Modified:
   trunk/doc/reference/tmpl/ephy-embed.sgml
   trunk/embed/ephy-base-embed.c
   trunk/embed/ephy-embed.c
   trunk/embed/ephy-embed.h
   trunk/embed/webkit/webkit-embed.c
   trunk/src/ephy-window.c

Modified: trunk/doc/reference/tmpl/ephy-embed.sgml
==============================================================================
--- trunk/doc/reference/tmpl/ephy-embed.sgml	(original)
+++ trunk/doc/reference/tmpl/ephy-embed.sgml	Mon Jun 30 21:27:12 2008
@@ -174,14 +174,6 @@
 @arg2: 
 @arg3: 
 
-<!-- ##### SIGNAL EphyEmbed::ge-zoom-change ##### -->
-<para>
-
-</para>
-
- ephyembed: the object which received the signal.
- arg1: 
-
 <!-- ##### SIGNAL EphyEmbed::new-document-now ##### -->
 <para>
 
@@ -327,7 +319,6 @@
 @get_is_blank: 
 @get_loading_title: 
 @get_visibility: 
- go_to_history_item: 
 
 <!-- ##### ENUM EphyEmbedChrome ##### -->
 <para>

Modified: trunk/embed/ephy-base-embed.c
==============================================================================
--- trunk/embed/ephy-base-embed.c	(original)
+++ trunk/embed/ephy-base-embed.c	Mon Jun 30 21:27:12 2008
@@ -55,7 +55,6 @@
   /* guint security_level : 3; ? */
   EphyEmbedDocumentType document_type;
   EphyEmbedNavigationFlags nav_flags;
-  float zoom;
 
   /* Flags */
   guint is_blank : 1;
@@ -108,7 +107,6 @@
   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 @@
     case PROP_SECURITY:
     case PROP_STATUS_MESSAGE:
     case PROP_VISIBLE:
-    case PROP_ZOOM:
       /* read only */
       break;
     default:
@@ -584,9 +581,6 @@
     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_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",
@@ -766,41 +752,6 @@
 }
 
 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,
                EphyBaseEmbed *bembed)
@@ -894,10 +845,6 @@
                            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 @@
 
   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 @@
   }
 }
 
+#if 0
 void
 ephy_base_embed_restore_zoom_level (EphyBaseEmbed *membed,
                                     const char *address)
@@ -1577,6 +1524,7 @@
     }
   }
 }
+#endif
 
 void
 ephy_base_embed_set_visibility (EphyBaseEmbed *embed,

Modified: trunk/embed/ephy-embed.c
==============================================================================
--- trunk/embed/ephy-embed.c	(original)
+++ trunk/embed/ephy-embed.c	Mon Jun 30 21:27:12 2008
@@ -208,27 +208,6 @@
 			      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:
  *

Modified: trunk/embed/ephy-embed.h
==============================================================================
--- trunk/embed/ephy-embed.h	(original)
+++ trunk/embed/ephy-embed.h	Mon Jun 30 21:27:12 2008
@@ -145,8 +145,6 @@
 					 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);

Modified: trunk/embed/webkit/webkit-embed.c
==============================================================================
--- trunk/embed/webkit/webkit-embed.c	(original)
+++ trunk/embed/webkit/webkit-embed.c	Mon Jun 30 21:27:12 2008
@@ -28,6 +28,7 @@
 #include "ephy-embed-single.h"
 #include "ephy-string.h"
 #include "ephy-embed-event.h"
+#include "ephy-embed-utils.h"
 
 #include <webkit/webkit.h>
 #include <string.h>
@@ -214,6 +215,46 @@
 }
 
 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)
 {
   WebKitEmbed *wembed = WEBKIT_EMBED (object);
@@ -263,6 +304,9 @@
                     "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 @@
   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

Modified: trunk/src/ephy-window.c
==============================================================================
--- trunk/src/ephy-window.c	(original)
+++ trunk/src/ephy-window.c	Mon Jun 30 21:27:12 2008
@@ -102,7 +102,7 @@
 static void sync_tab_security			(EphyEmbed  *embed,
 						 GParamSpec *pspec,
 						 EphyWindow *window);
-static void sync_tab_zoom			(EphyEmbed *embed,
+static void sync_tab_zoom			(WebKitWebView *web_view,
 						 GParamSpec *pspec,
 						 EphyWindow *window);
 
@@ -1544,7 +1544,7 @@
 	if (priv->closing) return;
 
 	/* update zoom actions */
-	sync_tab_zoom (embed, NULL, window);
+	sync_tab_zoom (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed), NULL, window);
 	
 	type = ephy_embed_get_document_type (embed);
 	can_find = (type != EPHY_EMBED_DOCUMENT_IMAGE);
@@ -1854,17 +1854,21 @@
 }
 
 static void
-sync_tab_zoom (EphyEmbed *embed, GParamSpec *pspec, EphyWindow *window)
+sync_tab_zoom (WebKitWebView *web_view, GParamSpec *pspec, EphyWindow *window)
 {
 	GtkActionGroup *action_group;
 	GtkAction *action;
 	EphyEmbedDocumentType type;
 	gboolean can_zoom_in = TRUE, can_zoom_out = TRUE, can_zoom_normal = FALSE, can_zoom;
 	float zoom;
+	EphyEmbed *embed = window->priv->active_embed;
 
 	if (window->priv->closing) return;
 
-	zoom = ephy_embed_get_zoom (embed);
+	g_object_get (G_OBJECT (web_view),
+		      "zoom-level", &zoom,
+		      NULL);
+
 	type = ephy_embed_get_document_type (embed);
 	can_zoom = (type != EPHY_EMBED_DOCUMENT_IMAGE);
 
@@ -2401,7 +2405,14 @@
 
 	if (old_embed != NULL)
 	{
+		WebKitWebView *web_view;
+
 		embed = old_embed;
+		web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+
+		g_signal_handlers_disconnect_by_func (web_view,
+						      G_CALLBACK (sync_tab_zoom),
+						      window);
 
 		g_signal_handlers_disconnect_by_func (embed,
 						      G_CALLBACK (sync_tab_popup_windows),
@@ -2416,9 +2427,6 @@
 						      G_CALLBACK (sync_tab_document_type),
 						      window);
 		g_signal_handlers_disconnect_by_func (embed,
-						      G_CALLBACK (sync_tab_zoom),
-						      window);
-		g_signal_handlers_disconnect_by_func (embed,
 						      G_CALLBACK (sync_tab_load_progress),
 						      window);
 		g_signal_handlers_disconnect_by_func (embed,
@@ -2454,11 +2462,12 @@
 
 	if (new_embed != NULL)
 	{
+		WebKitWebView *web_view;
+
 		embed = new_embed;
 
 		sync_tab_security	(embed, NULL, window);
 		sync_tab_document_type	(embed, NULL, window);
-		sync_tab_zoom		(embed, NULL, window);
 		sync_tab_load_progress	(embed, NULL, window);
 		sync_tab_load_status	(embed, NULL, window);
 		sync_tab_navigation	(embed, NULL, window);
@@ -2469,6 +2478,14 @@
 		sync_tab_popup_windows	(embed, NULL, window);
 		sync_tab_popups_allowed	(embed, NULL, window);
 
+		web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+
+		sync_tab_zoom		(web_view, NULL, window);
+
+		g_signal_connect_object (web_view, "notify::zoom-level",
+					 G_CALLBACK (sync_tab_zoom),
+					 window, 0);
+
 		g_signal_connect_object (embed, "notify::hidden-popup-count",
 					 G_CALLBACK (sync_tab_popup_windows),
 					 window, 0);
@@ -2493,9 +2510,6 @@
 		g_signal_connect_object (embed, "notify::document-type",
 					 G_CALLBACK (sync_tab_document_type),
 					 window, 0);
-		g_signal_connect_object (embed, "notify::zoom",
-					 G_CALLBACK (sync_tab_zoom),
-					 window, 0);
 		g_signal_connect_object (embed, "notify::load-status",
 					 G_CALLBACK (sync_tab_load_status),
 					 window, 0);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]