aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-01-30 23:20:36 +0800
committerChristian Persch <chpe@src.gnome.org>2005-01-30 23:20:36 +0800
commit8f01817138c1852b319898a5de3f4b9f244cdea5 (patch)
tree3473088e9fc4b6200a85e6714183e6f8482b2963 /embed
parent58dba74abaf6313221c50629e546dc4492672486 (diff)
downloadgsoc2013-epiphany-8f01817138c1852b319898a5de3f4b9f244cdea5.tar
gsoc2013-epiphany-8f01817138c1852b319898a5de3f4b9f244cdea5.tar.gz
gsoc2013-epiphany-8f01817138c1852b319898a5de3f4b9f244cdea5.tar.bz2
gsoc2013-epiphany-8f01817138c1852b319898a5de3f4b9f244cdea5.tar.lz
gsoc2013-epiphany-8f01817138c1852b319898a5de3f4b9f244cdea5.tar.xz
gsoc2013-epiphany-8f01817138c1852b319898a5de3f4b9f244cdea5.tar.zst
gsoc2013-epiphany-8f01817138c1852b319898a5de3f4b9f244cdea5.zip
Move new-window signal to the embed single, and new window creation from
2005-01-30 Christian Persch <chpe@cvs.gnome.org> * doc/reference/tmpl/ephy-embed.sgml: * embed/ephy-embed-single.c: (ephy_embed_single_iface_init): * embed/ephy-embed-single.h: * embed/ephy-embed.c: (ephy_embed_base_init): * embed/ephy-embed.h: * embed/mozilla/mozilla-embed-single.cpp: * embed/mozilla/mozilla-embed.cpp: * embed/mozilla/mozilla-embed.h: * lib/ephy-marshal.list: * lib/ephy-prefs.h: * src/ephy-shell.c: (ephy_shell_new_window_cb), (impl_get_embed_single): * src/ephy-tab.c: (ephy_tab_new_window_cb): Move new-window signal to the embed single, and new window creation from EphyTab to EphyShell.
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed-single.c23
-rw-r--r--embed/ephy-embed-single.h4
-rw-r--r--embed/ephy-embed.c14
-rw-r--r--embed/ephy-embed.h4
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp27
-rw-r--r--embed/mozilla/mozilla-embed.cpp63
-rw-r--r--embed/mozilla/mozilla-embed.h10
7 files changed, 103 insertions, 42 deletions
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c
index 3f5af639f..0b05dc876 100644
--- a/embed/ephy-embed-single.c
+++ b/embed/ephy-embed-single.c
@@ -23,6 +23,7 @@
#include "ephy-embed-single.h"
#include "ephy-embed-type-builtins.h"
#include "ephy-marshal.h"
+#include "ephy-signal-accumulator.h"
static void ephy_embed_single_iface_init (gpointer g_class);
@@ -57,6 +58,28 @@ ephy_embed_single_iface_init (gpointer g_class)
if (initialised == FALSE)
{
/**
+ * EphyEmbedSingle::new-window:
+ * @single:
+ * @parent_embed: the #EphyEmbed requesting the new window, or %NULL
+ * @mask: a #EphyEmbedChrome
+ *
+ * The ::new_window signal is emitted when a new window needs to be opened.
+ * For example, when a JavaScript popup window was opened.
+ *
+ * Return a new #EphyEmbed.
+ **/
+ g_signal_new ("new-window",
+ EPHY_TYPE_EMBED_SINGLE,
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyEmbedSingleIface, new_window),
+ ephy_signal_accumulator_object, ephy_embed_get_type,
+ ephy_marshal_OBJECT__OBJECT_FLAGS,
+ GTK_TYPE_WIDGET,
+ 2,
+ GTK_TYPE_WIDGET,
+ EPHY_TYPE_EMBED_CHROME);
+
+/**
* EphyEmbedSingle::handle_content:
* @single:
* @mime_type: the MIME type of the content
diff --git a/embed/ephy-embed-single.h b/embed/ephy-embed-single.h
index ceb2dcb19..03e4f9a05 100644
--- a/embed/ephy-embed-single.h
+++ b/embed/ephy-embed-single.h
@@ -53,6 +53,10 @@ struct _EphyEmbedSingleIface
/* Signals */
+ EphyEmbed * (* new_window) (EphyEmbedSingle *single,
+ EphyEmbed *parent_embed,
+ EphyEmbedChrome chromemask);
+
gboolean (* handle_content) (EphyEmbedSingle *shell,
char *mime_type,
char *uri);
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 376eede08..a331c2ab4 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -24,7 +24,6 @@
#include "ephy-embed-type-builtins.h"
#include "ephy-marshal.h"
-#include "ephy-signal-accumulator.h"
#include "mozilla-embed-single.h"
#include "mozilla-embed.h"
@@ -62,21 +61,20 @@ ephy_embed_base_init (gpointer g_class)
/**
* EphyEmbed::ge-new-window:
* @embed:
- * @mask: a #EphyChromeMask
+ * @new_embed: the newly opened #EphyEmbed
*
- * The ::ge_new_window signal is emitted when a new window has been opened by
+ * The ::ge_new_window signal is emitted after a new window has been opened by
* the embed. For example, when a JavaScript popup window is opened.
- * Return a new #EphyEmbed.
**/
g_signal_new ("ge_new_window",
EPHY_TYPE_EMBED,
G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EphyEmbedIface, new_window),
- ephy_signal_accumulator_object, ephy_embed_get_type,
- ephy_marshal_OBJECT__FLAGS,
- G_TYPE_OBJECT,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
1,
- EPHY_TYPE_EMBED_CHROME);
+ GTK_TYPE_WIDGET);
/**
* EphyEmbed::ge-popup-blocked:
* @embed:
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index d08174183..a25e74d78 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -138,8 +138,8 @@ struct _EphyEmbedIface
void (* modal_alert_closed) (EphyEmbed *embed);
void (* document_type) (EphyEmbed *embed,
EphyEmbedDocumentType type);
- EphyEmbed * (* new_window) (EphyEmbed *embed,
- EphyEmbedChrome chromemask);
+ void (* new_window) (EphyEmbed *embed,
+ EphyEmbed *new_embed);
/* Methods */
void (* load_url) (EphyEmbed *embed,
diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp
index f1ac51326..06e830319 100644
--- a/embed/mozilla/mozilla-embed-single.cpp
+++ b/embed/mozilla/mozilla-embed-single.cpp
@@ -312,14 +312,31 @@ mozilla_setup_colors (MozillaEmbedSingle *mes)
}
static void
-mozilla_embed_single_new_window_orphan_cb (GtkMozEmbedSingle *embed,
- GtkMozEmbed **retval,
+mozilla_embed_single_new_window_orphan_cb (GtkMozEmbedSingle *moz_single,
+ GtkMozEmbed **newEmbed,
guint chrome_mask,
- EphyEmbedSingle *shell)
+ EphyEmbedSingle *single)
{
- g_assert (chrome_mask & GTK_MOZ_EMBED_FLAG_OPENASCHROME);
+ GtkMozEmbedChromeFlags chrome = (GtkMozEmbedChromeFlags) chrome_mask;
+ EphyEmbed *new_embed = NULL;
+ EphyEmbedChrome mask;
- *retval = _mozilla_embed_new_xul_dialog ();
+ if (chrome_mask & GTK_MOZ_EMBED_FLAG_OPENASCHROME)
+ {
+ *newEmbed = _mozilla_embed_new_xul_dialog ();
+ return;
+ }
+
+ mask = _mozilla_embed_translate_chrome (chrome);
+
+ g_signal_emit_by_name (single, "new-window", NULL, mask,
+ &new_embed);
+
+ g_assert (new_embed != NULL);
+
+ gtk_moz_embed_set_chrome_mask (GTK_MOZ_EMBED (new_embed), chrome);
+
+ *newEmbed = GTK_MOZ_EMBED (new_embed);
}
static void
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 54db6067c..fc77d32ae 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -25,6 +25,7 @@
#include "mozilla-embed.h"
#include "mozilla-embed-event.h"
+#include "ephy-embed-single.h"
#include "ephy-embed-shell.h"
#include "ephy-command-manager.h"
#include "ephy-string.h"
@@ -65,7 +66,7 @@ static gboolean mozilla_embed_dom_mouse_down_cb (GtkMozEmbed *embed,
MozillaEmbed *membed);
static void mozilla_embed_new_window_cb (GtkMozEmbed *embed,
GtkMozEmbed **newEmbed,
- guint chromemask,
+ guint chrome_mask,
MozillaEmbed *membed);
static void mozilla_embed_security_change_cb (GtkMozEmbed *embed,
gpointer request,
@@ -932,20 +933,13 @@ mozilla_embed_dom_mouse_down_cb (GtkMozEmbed *embed, gpointer dom_event,
"ge_dom_mouse_down");
}
-static void
-mozilla_embed_new_window_cb (GtkMozEmbed *embed,
- GtkMozEmbed **newEmbed,
- guint chrome_mask,
- MozillaEmbed *membed)
+EphyEmbedChrome
+_mozilla_embed_translate_chrome (GtkMozEmbedChromeFlags flags)
{
- guint i;
- guint mask = 0;
- EphyEmbed *new_embed = NULL;
-
- struct
+ static const struct
{
- guint mozilla_mask;
- guint embed_mask;
+ guint mozilla_flag;
+ guint ephy_flag;
}
conversion_map [] =
{
@@ -953,28 +947,49 @@ mozilla_embed_new_window_cb (GtkMozEmbed *embed,
{ GTK_MOZ_EMBED_FLAG_TOOLBARON, EPHY_EMBED_CHROME_TOOLBAR },
{ GTK_MOZ_EMBED_FLAG_STATUSBARON, EPHY_EMBED_CHROME_STATUSBAR },
{ GTK_MOZ_EMBED_FLAG_PERSONALTOOLBARON, EPHY_EMBED_CHROME_BOOKMARKSBAR },
- { 0, 0 }
};
- if (chrome_mask & GTK_MOZ_EMBED_FLAG_OPENASCHROME)
- {
- *newEmbed = _mozilla_embed_new_xul_dialog ();
- return;
- }
+ guint mask = 0, i;
- for (i = 0; conversion_map[i].mozilla_mask != 0; i++)
+ for (i = 0; i < G_N_ELEMENTS (conversion_map); i++)
{
- if (chrome_mask & conversion_map[i].mozilla_mask)
+ if (flags & conversion_map[i].mozilla_flag)
{
- mask |= conversion_map[i].embed_mask;
+ mask |= conversion_map[i].ephy_flag;
}
}
- g_signal_emit_by_name (membed, "ge_new_window", mask, &new_embed);
+ return (EphyEmbedChrome) mask;
+}
+
+static void
+mozilla_embed_new_window_cb (GtkMozEmbed *embed,
+ GtkMozEmbed **newEmbed,
+ guint chrome_mask,
+ MozillaEmbed *membed)
+{
+ GtkMozEmbedChromeFlags chrome = (GtkMozEmbedChromeFlags) chrome_mask;
+ EphyEmbed *new_embed = NULL;
+ GObject *single;
+ EphyEmbedChrome mask;
+
+ if (chrome & GTK_MOZ_EMBED_FLAG_OPENASCHROME)
+ {
+ *newEmbed = _mozilla_embed_new_xul_dialog ();
+ return;
+ }
+
+ mask = _mozilla_embed_translate_chrome (chrome);
+
+ single = ephy_embed_shell_get_embed_single (embed_shell);
+ g_signal_emit_by_name (single, "new-window", embed, mask,
+ &new_embed);
g_assert (new_embed != NULL);
- gtk_moz_embed_set_chrome_mask (GTK_MOZ_EMBED (new_embed), chrome_mask);
+ gtk_moz_embed_set_chrome_mask (GTK_MOZ_EMBED (new_embed), chrome);
+
+ g_signal_emit_by_name (membed, "ge-new-window", new_embed);
*newEmbed = GTK_MOZ_EMBED (new_embed);
}
diff --git a/embed/mozilla/mozilla-embed.h b/embed/mozilla/mozilla-embed.h
index 64bb5ccd8..d10c850b8 100644
--- a/embed/mozilla/mozilla-embed.h
+++ b/embed/mozilla/mozilla-embed.h
@@ -54,11 +54,15 @@ struct MozillaEmbedClass
GtkMozEmbedClass parent_class;
};
-GType mozilla_embed_get_type (void);
+GType mozilla_embed_get_type (void);
-gpointer _mozilla_embed_get_ephy_browser (MozillaEmbed *embed);
+/* The following are private to the embed implementation */
-GtkMozEmbed *_mozilla_embed_new_xul_dialog (void);
+gpointer _mozilla_embed_get_ephy_browser (MozillaEmbed *embed);
+
+GtkMozEmbed *_mozilla_embed_new_xul_dialog (void);
+
+EphyEmbedChrome _mozilla_embed_translate_chrome (GtkMozEmbedChromeFlags flags);
G_END_DECLS