Author: xan
Date: Sun Feb 17 18:20:39 2008
New Revision: 7959
URL: http://svn.gnome.org/viewvc/epiphany?rev=7959&view=rev

Log:
Add ephy-embed::new-document-now signal, does the same than old
ge-content-change (used by adblock extension).

Part of #502283


Modified:
   trunk/doc/reference/tmpl/ephy-embed.sgml
   trunk/embed/ephy-embed.c
   trunk/embed/ephy-embed.h
   trunk/embed/mozilla/mozilla-embed.cpp
   trunk/embed/webkit/webkit-embed.c

Modified: trunk/doc/reference/tmpl/ephy-embed.sgml
==============================================================================
--- trunk/doc/reference/tmpl/ephy-embed.sgml    (original)
+++ trunk/doc/reference/tmpl/ephy-embed.sgml    Sun Feb 17 18:20:39 2008
@@ -150,6 +150,11 @@
 
 </para>
 
+<!-- ##### SIGNAL EphyEmbed::new-document-now ##### -->
+<para>
+
+</para>
+
 @ephyembed: the object which received the signal.
 @: 
 @: 

Modified: trunk/embed/ephy-embed.c
==============================================================================
--- trunk/embed/ephy-embed.c    (original)
+++ trunk/embed/ephy-embed.c    Sun Feb 17 18:20:39 2008
@@ -345,6 +345,26 @@
                              G_TYPE_NONE,
                              1,
                              G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
+/**
+ * EphyEmbed::new-document-now:
+ * @embed:
+ * @uri: URI of the new content
+ *
+ * The ::new-document-now signal is emitted when a new page content
+ * is being loaded into the browser. It's a good place to do view
+ * related changes, for example to restore the zoom level of a page
+ * or to set an user style sheet.
+ **/
+              g_signal_new ("new-document-now",
+                            EPHY_TYPE_EMBED,
+                            G_SIGNAL_RUN_FIRST,
+                            G_STRUCT_OFFSET (EphyEmbedIface, new_document_now),
+                            NULL, NULL,
+                            g_cclosure_marshal_VOID__STRING,
+                            G_TYPE_NONE,
+                            1,
+                            G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
+
 
                initialized = TRUE;
        }

Modified: trunk/embed/ephy-embed.h
==============================================================================
--- trunk/embed/ephy-embed.h    (original)
+++ trunk/embed/ephy-embed.h    Sun Feb 17 18:20:39 2008
@@ -156,6 +156,9 @@
                                         GdkEventKey *event);
        gboolean (* close_request)      (EphyEmbed *embed);
 
+       void     (* new_document_now)   (EphyEmbed *embed,
+                                        const char *uri);
+
        /* Methods  */
        void               (* load_url)                   (EphyEmbed *embed,
                                                           const char *url);

Modified: trunk/embed/mozilla/mozilla-embed.cpp
==============================================================================
--- trunk/embed/mozilla/mozilla-embed.cpp       (original)
+++ trunk/embed/mozilla/mozilla-embed.cpp       Sun Feb 17 18:20:39 2008
@@ -970,6 +970,7 @@
 
                char *address;
                address = gtk_moz_embed_get_location (moz_embed);
+               g_signal_emit_by_name (membed, "new-document-now", address);
                ephy_base_embed_popups_manager_reset (EPHY_BASE_EMBED (membed));
                ephy_base_embed_restore_zoom_level (EPHY_BASE_EMBED (membed), 
address);
                g_free (address);

Modified: trunk/embed/webkit/webkit-embed.c
==============================================================================
--- trunk/embed/webkit/webkit-embed.c   (original)
+++ trunk/embed/webkit/webkit-embed.c   Sun Feb 17 18:20:39 2008
@@ -181,12 +181,16 @@
   EphyEmbedNetState estate = EPHY_EMBED_STATE_UNKNOWN;
 
   if (embed->priv->load_state == WEBKIT_EMBED_LOAD_STARTED)
+    {
       estate = (EphyEmbedNetState) (estate |
                                     EPHY_EMBED_STATE_START |
                                     EPHY_EMBED_STATE_NEGOTIATING |
                                     EPHY_EMBED_STATE_IS_REQUEST |
                                     EPHY_EMBED_STATE_IS_NETWORK);
 
+      g_signal_emit_by_name (embed, "new-document-now", 
embed->priv->loading_uri);
+    }
+
   if (embed->priv->load_state == WEBKIT_EMBED_LOAD_LOADING)
       estate = (EphyEmbedNetState) (estate |
                                     EPHY_EMBED_STATE_TRANSFERRING |
_______________________________________________
SVN-commits-list mailing list (read only)
http://mail.gnome.org/mailman/listinfo/svn-commits-list

Want to limit the commits to a few modules? Go to above URL, log in to edit 
your options and select the modules ('topics') you want.
Module maintainer? It is possible to set the reply-to to your development 
mailing list. Email [EMAIL PROTECTED] if interested.

Reply via email to