aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/reference/tmpl/ephy-embed.sgml5
-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
5 files changed, 33 insertions, 0 deletions
diff --git a/doc/reference/tmpl/ephy-embed.sgml b/doc/reference/tmpl/ephy-embed.sgml
index a1d6a3384..42e21f5a9 100644
--- a/doc/reference/tmpl/ephy-embed.sgml
+++ b/doc/reference/tmpl/ephy-embed.sgml
@@ -150,6 +150,11 @@ be done by casting).
</para>
+<!-- ##### SIGNAL EphyEmbed::new-document-now ##### -->
+<para>
+
+</para>
+
@ephyembed: the object which received the signal.
@:
@:
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 |