aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-11-01 20:46:07 +0800
committerChristian Persch <chpe@src.gnome.org>2005-11-01 20:46:07 +0800
commitac160bd5b4143c52f8a75c049a27f56136ce1bae (patch)
treefd6b2290b725692501f98e01faf5cadb9ac01d21
parent709f0858814f1ece4bdeb288c2a4ae907a08c358 (diff)
downloadgsoc2013-epiphany-ac160bd5b4143c52f8a75c049a27f56136ce1bae.tar
gsoc2013-epiphany-ac160bd5b4143c52f8a75c049a27f56136ce1bae.tar.gz
gsoc2013-epiphany-ac160bd5b4143c52f8a75c049a27f56136ce1bae.tar.bz2
gsoc2013-epiphany-ac160bd5b4143c52f8a75c049a27f56136ce1bae.tar.lz
gsoc2013-epiphany-ac160bd5b4143c52f8a75c049a27f56136ce1bae.tar.xz
gsoc2013-epiphany-ac160bd5b4143c52f8a75c049a27f56136ce1bae.tar.zst
gsoc2013-epiphany-ac160bd5b4143c52f8a75c049a27f56136ce1bae.zip
Get the window name from the popup-blocked event.
2005-11-01 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-embed.c: (ephy_embed_base_init): * embed/ephy-embed.h: * embed/mozilla/EphyBrowser.cpp: * src/ephy-tab.c: (popups_manager_free_info), (popups_manager_add), (popups_manager_show), (popups_manager_hide), (ephy_tab_popup_blocked_cb): Get the window name from the popup-blocked event.
-rw-r--r--ChangeLog11
-rw-r--r--embed/ephy-embed.c6
-rw-r--r--embed/ephy-embed.h1
-rw-r--r--embed/mozilla/EphyBrowser.cpp14
-rw-r--r--src/ephy-tab.c23
5 files changed, 44 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index b3aa89d3e..ff3889971 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2005-11-01 Christian Persch <chpe@cvs.gnome.org>
+ * embed/ephy-embed.c: (ephy_embed_base_init):
+ * embed/ephy-embed.h:
+ * embed/mozilla/EphyBrowser.cpp:
+ * src/ephy-tab.c: (popups_manager_free_info), (popups_manager_add),
+ (popups_manager_show), (popups_manager_hide),
+ (ephy_tab_popup_blocked_cb):
+
+ Get the window name from the popup-blocked event.
+
+2005-11-01 Christian Persch <chpe@cvs.gnome.org>
+
* embed/mozilla/ContentHandler.cpp:
* embed/mozilla/GtkNSSClientAuthDialogs.cpp:
* embed/mozilla/GtkNSSDialogs.cpp:
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 8c27762e8..2c6a97b25 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -79,6 +79,7 @@ ephy_embed_base_init (gpointer g_class)
* EphyEmbed::ge-popup-blocked:
* @embed:
* @address: The requested URL
+ * @target: The requested window name, e.g. "_blank"
* @features: The requested features: for example, "height=400,width=200"
*
* The ::ge_popup_blocked signal is emitted when the viewed web page requests
@@ -89,9 +90,10 @@ ephy_embed_base_init (gpointer g_class)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EphyEmbedIface, popup_blocked),
NULL, NULL,
- ephy_marshal_VOID__STRING_STRING,
+ ephy_marshal_VOID__STRING_STRING_STRING,
G_TYPE_NONE,
- 2,
+ 3,
+ G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index 4f268cd3b..02d3f3cb6 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -134,6 +134,7 @@ struct _EphyEmbedIface
gpointer event);
void (* popup_blocked) (EphyEmbed *embed,
const char *address,
+ const char *target,
const char *features);
void (* security_change) (EphyEmbed *embed,
EphyEmbedSecurityLevel level);
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp
index 06f84bd94..7bfda8bcc 100644
--- a/embed/mozilla/EphyBrowser.cpp
+++ b/embed/mozilla/EphyBrowser.cpp
@@ -367,8 +367,20 @@ EphyPopupBlockEventListener::HandleEvent (nsIDOMEvent * aDOMEvent)
NS_CSTRING_ENCODING_UTF8,
popupWindowFeaturesString);
- g_signal_emit_by_name(mOwner->mEmbed, "ge_popup_blocked",
+ nsEmbedCString popupWindowNameString;
+#ifdef HAVE_GECKO_1_9
+ nsEmbedString popupWindowName;
+ rv = popupEvent->GetPopupWindowName (popupWindowName);
+ NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
+
+ NS_UTF16ToCString (popupWindowName,
+ NS_CSTRING_ENCODING_UTF8,
+ popupWindowNameString);
+#endif
+
+ g_signal_emit_by_name(mOwner->mEmbed, "ge-popup-blocked",
popupWindowURIString.get(),
+ popupWindowNameString.get(),
popupWindowFeaturesString.get());
return NS_OK;
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 0546a96f2..ceabed0bf 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -139,6 +139,7 @@ enum
typedef struct
{
char *url;
+ char *name;
char *features;
} PopupInfo;
@@ -522,6 +523,7 @@ static void
popups_manager_free_info (PopupInfo *popup)
{
g_free (popup->url);
+ g_free (popup->name);
g_free (popup->features);
g_free (popup);
}
@@ -529,8 +531,10 @@ popups_manager_free_info (PopupInfo *popup)
static void
popups_manager_add (EphyTab *tab,
const char *url,
+ const char *name,
const char *features)
{
+ EphyTabPrivate *priv = tab->priv;
PopupInfo *popup;
LOG ("popups_manager_add: tab %p, url %s, features %s",
@@ -541,10 +545,10 @@ popups_manager_add (EphyTab *tab,
popup = g_new0 (PopupInfo, 1);
popup->url = g_strdup (url);
+ popup->name = g_strdup (name);
popup->features = g_strdup (features);
- tab->priv->hidden_popups = g_slist_prepend
- (tab->priv->hidden_popups, popup);
+ priv->hidden_popups = g_slist_prepend (priv->hidden_popups, popup);
if (popup_blocker_n_hidden (tab) > MAX_HIDDEN_POPUPS) /* bug #160863 */
{
@@ -661,8 +665,8 @@ popups_manager_show (PopupInfo *popup,
single = EPHY_EMBED_SINGLE
(ephy_embed_shell_get_embed_single (embed_shell));
- ephy_embed_single_open_window (single, embed, popup->url, "",
- popup->features);
+ ephy_embed_single_open_window (single, embed, popup->url,
+ popup->name, popup->features);
popups_manager_free_info (popup);
}
@@ -720,7 +724,7 @@ popups_manager_hide (EphyWindow *window,
features = popups_manager_new_window_info (window);
- popups_manager_add (parent_tab, location, features);
+ popups_manager_add (parent_tab, location, "" /* FIXME? maybe _blank? */, features);
gtk_widget_destroy (GTK_WIDGET (window));
@@ -1778,10 +1782,13 @@ ephy_tab_new_window_cb (EphyEmbed *embed,
}
static void
-ephy_tab_popup_blocked_cb (EphyEmbed *embed, const char *url,
- const char *features, EphyTab *tab)
+ephy_tab_popup_blocked_cb (EphyEmbed *embed,
+ const char *url,
+ const char *name,
+ const char *features,
+ EphyTab *tab)
{
- popups_manager_add (tab, url, features);
+ popups_manager_add (tab, url, name, features);
}
static void