aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2008-02-18 02:20:39 +0800
committerXan Lopez <xan@src.gnome.org>2008-02-18 02:20:39 +0800
commit861720c0698e978b8278ab17f003c297f44beff4 (patch)
treee70e9ce25658814f8054f19f729cf72328d51e3a /embed
parent8b6ad442626717a523b284720ba2545cbeb84181 (diff)
downloadgsoc2013-epiphany-861720c0698e978b8278ab17f003c297f44beff4.tar
gsoc2013-epiphany-861720c0698e978b8278ab17f003c297f44beff4.tar.gz
gsoc2013-epiphany-861720c0698e978b8278ab17f003c297f44beff4.tar.bz2
gsoc2013-epiphany-861720c0698e978b8278ab17f003c297f44beff4.tar.lz
gsoc2013-epiphany-861720c0698e978b8278ab17f003c297f44beff4.tar.xz
gsoc2013-epiphany-861720c0698e978b8278ab17f003c297f44beff4.tar.zst
gsoc2013-epiphany-861720c0698e978b8278ab17f003c297f44beff4.zip
Add ephy-embed::new-document-now signal, does the same than old
ge-content-change (used by adblock extension). Part of #502283 svn path=/trunk/; revision=7959
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed.c20
-rw-r--r--embed/ephy-embed.h3
-rw-r--r--embed/mozilla/mozilla-embed.cpp1
-rw-r--r--embed/webkit/webkit-embed.c4
4 files changed, 28 insertions, 0 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 267b353fc..98f9d30b5 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -345,6 +345,26 @@ ephy_embed_base_init (gpointer g_class)
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;
}
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 560a2f9cd..ed3934c8f 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -156,6 +156,9 @@ struct _EphyEmbedIface
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);
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 77d11b224..dfa3c23a1 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -970,6 +970,7 @@ update_load_state (MozillaEmbed *membed, gint state)
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);
diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c
index 6447f91b9..5a8546ae5 100644
--- a/embed/webkit/webkit-embed.c
+++ b/embed/webkit/webkit-embed.c
@@ -181,12 +181,16 @@ update_load_state (WebKitEmbed *embed, WebKitWebView *web_view)
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 |