From 6638472fdbeee7c135c822ada01d09f407ca18e6 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Thu, 25 Oct 2007 20:01:00 +0000 Subject: Move title/address update on open-uri signal to EphyEmbed. Also refactor some common code in ephy-embed-utils.c svn path=/trunk/; revision=7562 --- embed/mozilla/mozilla-embed.cpp | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'embed/mozilla/mozilla-embed.cpp') diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index 4ac762617..16ef8245f 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -105,6 +105,9 @@ static void mozilla_embed_set_icon_address (MozillaEmbed *embed, static void mozilla_embed_favicon_cb (EphyEmbed *embed, const char *address, MozillaEmbed *membed); +static gboolean mozilla_embed_open_uri_cb (EphyEmbed *embed, + const char *uri, + MozillaEmbed *membed); static void impl_set_typed_address (EphyEmbed *embed, const char *address, EphyEmbedAddressExpire expire); @@ -439,6 +442,9 @@ mozilla_embed_init (MozillaEmbed *embed) g_signal_connect_object (embed, "ge_favicon", G_CALLBACK (mozilla_embed_favicon_cb), embed, (GConnectFlags)0); + g_signal_connect_object (embed, "open_uri", + G_CALLBACK (mozilla_embed_open_uri_cb), + embed,(GConnectFlags) 0); cache = EPHY_FAVICON_CACHE (ephy_embed_shell_get_favicon_cache (embed_shell)); @@ -1195,6 +1201,22 @@ impl_get_link_message (EphyEmbed *embed) return priv->link_message; } +static gboolean +impl_get_is_blank (EphyEmbed *embed) +{ + MozillaEmbedPrivate *priv = MOZILLA_EMBED (embed)->priv; + + return priv->is_blank; +} + +static const char* +impl_get_loading_title (EphyEmbed *embed) +{ + MozillaEmbedPrivate *priv = MOZILLA_EMBED (embed)->priv; + + return priv->loading_title; +} + static void mozilla_embed_set_address (MozillaEmbed *embed, char *address) { @@ -2224,6 +2246,26 @@ mozilla_embed_title_change_cb (EphyEmbed *embed, g_object_thaw_notify (object); } +static gboolean +mozilla_embed_open_uri_cb (EphyEmbed *embed, + const char *uri, + MozillaEmbed *membed) +{ + MozillaEmbedPrivate *priv = membed->priv; + + /* Set the address here if we have a blank page. + * See bug #147840. + */ + if (priv->is_blank) + { + mozilla_embed_set_address (membed, g_strdup (uri)); + mozilla_embed_set_loading_title (membed, uri, TRUE); + } + + /* allow load to proceed */ + return FALSE; +} + static EphyEmbedSecurityLevel mozilla_embed_security_level (PRUint32 state) { @@ -2303,6 +2345,8 @@ ephy_embed_iface_init (EphyEmbedIface *iface) iface->set_typed_address = impl_set_typed_address; iface->get_address = impl_get_address; iface->get_status_message = impl_get_status_message; + iface->get_is_blank = impl_get_is_blank; + iface->get_loading_title = impl_get_loading_title; } static void -- cgit v1.2.3