aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-11-11 18:19:04 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-11-11 18:19:04 +0800
commit7beb933c60288ce8e5756e591a089a82ab1c6b6c (patch)
tree06e3ab839f705249f1ee3e17d2a920133a97916a
parent760bb6dfe800fb1edd33d158ee19bd898f09fb2e (diff)
downloadgsoc2013-epiphany-7beb933c60288ce8e5756e591a089a82ab1c6b6c.tar
gsoc2013-epiphany-7beb933c60288ce8e5756e591a089a82ab1c6b6c.tar.gz
gsoc2013-epiphany-7beb933c60288ce8e5756e591a089a82ab1c6b6c.tar.bz2
gsoc2013-epiphany-7beb933c60288ce8e5756e591a089a82ab1c6b6c.tar.lz
gsoc2013-epiphany-7beb933c60288ce8e5756e591a089a82ab1c6b6c.tar.xz
gsoc2013-epiphany-7beb933c60288ce8e5756e591a089a82ab1c6b6c.tar.zst
gsoc2013-epiphany-7beb933c60288ce8e5756e591a089a82ab1c6b6c.zip
Build xul dialogs using GtkWindow+GtkMozEmbed. Make src code simpler and
2003-11-11 Marco Pesenti Gritti <marco@gnome.org> * embed/ephy-embed-single.c: (ephy_embed_single_class_init): * embed/ephy-embed-single.h: * embed/mozilla/mozilla-embed-persist.cpp: * embed/mozilla/mozilla-embed-single.cpp: * embed/mozilla/mozilla-embed.cpp: * embed/mozilla/mozilla-embed.h: * src/ephy-nautilus-view.c: (gnv_embed_new_window_cb): * src/ephy-session.c: (write_ephy_window): * src/ephy-shell.c: (ephy_shell_init): * src/ephy-tab.c: (ephy_tab_size_to_cb): * src/ephy-window.c: (translate_default_chrome): Build xul dialogs using GtkWindow+GtkMozEmbed. Make src code simpler and fix a pair of bugs.
-rw-r--r--ChangeLog17
-rw-r--r--embed/ephy-embed-single.c20
-rw-r--r--embed/ephy-embed-single.h7
-rw-r--r--embed/mozilla/mozilla-embed-persist.cpp2
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp39
-rw-r--r--embed/mozilla/mozilla-embed.cpp49
-rw-r--r--embed/mozilla/mozilla-embed.h6
-rw-r--r--src/ephy-nautilus-view.c6
-rw-r--r--src/ephy-session.c5
-rw-r--r--src/ephy-shell.c24
-rw-r--r--src/ephy-tab.c7
-rw-r--r--src/ephy-window.c1
12 files changed, 72 insertions, 111 deletions
diff --git a/ChangeLog b/ChangeLog
index e5f6d59a9..7dc73b400 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2003-11-11 Marco Pesenti Gritti <marco@gnome.org>
+
+ * embed/ephy-embed-single.c: (ephy_embed_single_class_init):
+ * embed/ephy-embed-single.h:
+ * embed/mozilla/mozilla-embed-persist.cpp:
+ * embed/mozilla/mozilla-embed-single.cpp:
+ * embed/mozilla/mozilla-embed.cpp:
+ * embed/mozilla/mozilla-embed.h:
+ * src/ephy-nautilus-view.c: (gnv_embed_new_window_cb):
+ * src/ephy-session.c: (write_ephy_window):
+ * src/ephy-shell.c: (ephy_shell_init):
+ * src/ephy-tab.c: (ephy_tab_size_to_cb):
+ * src/ephy-window.c: (translate_default_chrome):
+
+ Build xul dialogs using GtkWindow+GtkMozEmbed.
+ Make src code simpler and fix a pair of bugs.
+
2003-11-10 Christian Persch <chpe@cvs.gnome.org>
* data/glade/Makefile.am:
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c
index c09a0defa..359b33069 100644
--- a/embed/ephy-embed-single.c
+++ b/embed/ephy-embed-single.c
@@ -31,12 +31,6 @@
#include <string.h>
-enum
-{
- NEW_WINDOW,
- LAST_SIGNAL
-};
-
#define EPHY_EMBED_SINGLE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED_SINGLE, EphyEmbedSinglePrivate))
struct EphyEmbedSinglePrivate
@@ -53,8 +47,6 @@ ephy_embed_single_init (EphyEmbedSingle *ges);
static GObjectClass *parent_class = NULL;
-static guint ephy_embed_single_signals[LAST_SIGNAL] = { 0 };
-
GType
ephy_embed_single_get_type (void)
{
@@ -90,18 +82,6 @@ ephy_embed_single_class_init (EphyEmbedSingleClass *klass)
parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
- ephy_embed_single_signals[NEW_WINDOW] =
- g_signal_new ("new_window_orphan",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EphyEmbedSingleClass, new_window),
- NULL, NULL,
- ephy_marshal_VOID__POINTER_INT,
- G_TYPE_NONE,
- 2,
- G_TYPE_POINTER,
- G_TYPE_INT);
-
g_type_class_add_private (object_class, sizeof(EphyEmbedSinglePrivate));
}
diff --git a/embed/ephy-embed-single.h b/embed/ephy-embed-single.h
index 598ccdfd3..8dc55c1ee 100644
--- a/embed/ephy-embed-single.h
+++ b/embed/ephy-embed-single.h
@@ -107,13 +107,6 @@ struct EphyEmbedSingleClass
{
GObjectClass parent_class;
- /* Signals */
- void (* new_window) (EphyEmbedSingle *shell,
- EphyEmbed **new_embed,
- EmbedChromeMask chromemask);
-
- /* Methods */
-
void (* clear_cache) (EphyEmbedSingle *shell);
void (* set_offline_mode) (EphyEmbedSingle *shell,
gboolean offline);
diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp
index d1a0785ce..166942139 100644
--- a/embed/mozilla/mozilla-embed-persist.cpp
+++ b/embed/mozilla/mozilla-embed-persist.cpp
@@ -154,7 +154,7 @@ impl_save (EphyEmbedPersist *persist)
EphyBrowser *browser = NULL;
if (embed)
{
- browser = (EphyBrowser *) mozilla_embed_get_ephy_browser (MOZILLA_EMBED(embed));
+ browser = (EphyBrowser *) _mozilla_embed_get_ephy_browser (MOZILLA_EMBED(embed));
g_return_val_if_fail (browser != NULL, FALSE);
}
diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp
index df298d73a..6f03b5ea9 100644
--- a/embed/mozilla/mozilla-embed-single.cpp
+++ b/embed/mozilla/mozilla-embed-single.cpp
@@ -25,6 +25,7 @@
#include "glib.h"
#include "ephy-debug.h"
#include "gtkmozembed.h"
+#include "mozilla-embed.h"
#include "mozilla-embed-single.h"
#include "ephy-file-helpers.h"
#include "mozilla-notifiers.h"
@@ -231,43 +232,9 @@ mozilla_embed_single_new_window_orphan_cb (GtkMozEmbedSingle *embed,
guint chrome_mask,
EphyEmbedSingle *shell)
{
- /* FIXME conversion duped in mozilla_embed */
- EphyEmbed *new_embed;
- int i;
- EmbedChromeMask mask = EMBED_CHROME_OPENASPOPUP;
-
- struct
- {
- guint chromemask;
- EmbedChromeMask embed_mask;
- }
- conversion_map [] =
- {
- { GTK_MOZ_EMBED_FLAG_DEFAULTCHROME, EMBED_CHROME_DEFAULT },
- { GTK_MOZ_EMBED_FLAG_MENUBARON, EMBED_CHROME_MENUBARON },
- { GTK_MOZ_EMBED_FLAG_TOOLBARON, EMBED_CHROME_TOOLBARON },
- { GTK_MOZ_EMBED_FLAG_STATUSBARON, EMBED_CHROME_STATUSBARON },
- { GTK_MOZ_EMBED_FLAG_WINDOWRAISED, EMBED_CHROME_WINDOWRAISED },
- { GTK_MOZ_EMBED_FLAG_WINDOWLOWERED, EMBED_CHROME_WINDOWLOWERED },
- { GTK_MOZ_EMBED_FLAG_CENTERSCREEN, EMBED_CHROME_CENTERSCREEN },
- { GTK_MOZ_EMBED_FLAG_OPENASDIALOG, EMBED_CHROME_OPENASDIALOG },
- { GTK_MOZ_EMBED_FLAG_OPENASCHROME, EMBED_CHROME_OPENASCHROME },
- { 0, EMBED_CHROME_NONE }
- };
+ g_assert (chrome_mask && GTK_MOZ_EMBED_FLAG_OPENASCHROME);
- for (i = 0; conversion_map[i].chromemask != 0; i++)
- {
- if (chrome_mask & conversion_map[i].chromemask)
- {
- mask = (EmbedChromeMask) (mask | conversion_map[i].embed_mask);
- }
- }
-
- g_signal_emit_by_name (shell, "new_window_orphan", &new_embed, mask);
-
- g_assert (new_embed != NULL);
-
- *retval = GTK_MOZ_EMBED(EPHY_EMBED(new_embed));
+ *retval = _mozilla_embed_new_xul_dialog ();
}
static void
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index c41ecbf3a..0b8e3fea7 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -277,7 +277,7 @@ mozilla_embed_init (MozillaEmbed *embed)
}
gpointer
-mozilla_embed_get_ephy_browser (MozillaEmbed *embed)
+_mozilla_embed_get_ephy_browser (MozillaEmbed *embed)
{
g_return_val_if_fail (embed->priv->browser != NULL, NULL);
@@ -1015,11 +1015,15 @@ mozilla_embed_new_window_cb (GtkMozEmbed *embed,
{ GTK_MOZ_EMBED_FLAG_WINDOWRAISED, EMBED_CHROME_WINDOWRAISED },
{ GTK_MOZ_EMBED_FLAG_WINDOWLOWERED, EMBED_CHROME_WINDOWLOWERED },
{ GTK_MOZ_EMBED_FLAG_CENTERSCREEN, EMBED_CHROME_CENTERSCREEN },
- { GTK_MOZ_EMBED_FLAG_OPENASDIALOG, EMBED_CHROME_OPENASDIALOG },
- { GTK_MOZ_EMBED_FLAG_OPENASCHROME, EMBED_CHROME_OPENASCHROME },
{ 0, EMBED_CHROME_NONE }
};
+ if (chromemask && GTK_MOZ_EMBED_FLAG_OPENASCHROME)
+ {
+ *newEmbed = _mozilla_embed_new_xul_dialog ();
+ return;
+ }
+
for (i = 0; conversion_map[i].chromemask != 0; i++)
{
if (chromemask & conversion_map[i].chromemask)
@@ -1114,3 +1118,42 @@ ephy_embed_init (EphyEmbedClass *embed_class)
embed_class->print_preview_n_pages = impl_print_preview_n_pages;
embed_class->print_preview_navigate = impl_print_preview_navigate;
}
+
+void
+xul_visibility_cb (GtkWidget *embed, gboolean visibility, GtkWidget *window)
+{
+ if (visibility)
+ {
+ gtk_widget_show (window);
+ }
+ else
+ {
+ gtk_widget_hide (window);
+ }
+}
+
+void
+xul_size_to_cb (GtkWidget *embed, gint width, gint height)
+{
+ gtk_widget_set_size_request (embed, width, height);
+}
+
+GtkMozEmbed *
+_mozilla_embed_new_xul_dialog (void)
+{
+ GtkWidget *window, *embed;
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ embed = gtk_moz_embed_new ();
+ gtk_widget_show (embed);
+ gtk_container_add (GTK_CONTAINER (window), embed);
+
+ g_signal_connect_swapped (embed, "destroy_browser",
+ G_CALLBACK (gtk_widget_destroy), window);
+ g_signal_connect (embed, "visibility",
+ G_CALLBACK (xul_visibility_cb), window);
+ g_signal_connect (embed, "size_to",
+ G_CALLBACK (xul_size_to_cb), NULL);
+
+ return GTK_MOZ_EMBED (embed);
+}
diff --git a/embed/mozilla/mozilla-embed.h b/embed/mozilla/mozilla-embed.h
index 8070ac480..4eba0dba9 100644
--- a/embed/mozilla/mozilla-embed.h
+++ b/embed/mozilla/mozilla-embed.h
@@ -52,9 +52,11 @@ 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);
+gpointer _mozilla_embed_get_ephy_browser (MozillaEmbed *embed);
+
+GtkMozEmbed *_mozilla_embed_new_xul_dialog (void);
G_END_DECLS
diff --git a/src/ephy-nautilus-view.c b/src/ephy-nautilus-view.c
index b79e0d7fc..e1c799dbd 100644
--- a/src/ephy-nautilus-view.c
+++ b/src/ephy-nautilus-view.c
@@ -409,12 +409,6 @@ gnv_embed_new_window_cb (EphyEmbed *embed, EphyEmbed **new_embed,
EphyWindow *window;
window = ephy_window_new ();
- if (!(chromemask & EMBED_CHROME_OPENASCHROME))
- {
- ephy_window_set_chrome (window,
- chromemask |
- EMBED_CHROME_OPENASPOPUP);
- }
new_tab = ephy_tab_new ();
ephy_window_add_tab (window, new_tab, EPHY_NOTEBOOK_INSERT_LAST, FALSE);
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 63a646724..2a78ccb83 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -541,7 +541,6 @@ static int
write_ephy_window (xmlTextWriterPtr writer,
EphyWindow *window)
{
- EmbedChromeMask chrome;
GList *tabs, *l;
int ret;
@@ -552,10 +551,6 @@ write_ephy_window (xmlTextWriterPtr writer,
*/
if (tabs == NULL) return 0;
- /* skip if it's a XUL dialog */
- chrome = ephy_window_get_chrome (window);
- if (chrome & EMBED_CHROME_OPENASCHROME) return 0;
-
ret = xmlTextWriterStartElement (writer, "window");
if (ret < 0) return ret;
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index c476d3ac1..2a10315c6 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -145,25 +145,6 @@ ephy_shell_class_init (EphyShellClass *klass)
}
static void
-ephy_shell_new_window_cb (EphyEmbedShell *shell,
- EphyEmbed **new_embed,
- EmbedChromeMask chromemask,
- gpointer data)
-{
- EphyTab *new_tab;
- EphyWindow *window;
-
- g_assert (new_embed != NULL);
-
- window = ephy_window_new ();
- ephy_window_set_chrome (window, chromemask);
-
- new_tab = ephy_tab_new ();
- ephy_window_add_tab (window, new_tab, EPHY_NOTEBOOK_INSERT_GROUPED, FALSE);
- *new_embed = ephy_tab_get_embed (new_tab);
-}
-
-static void
ephy_shell_init (EphyShell *gs)
{
EphyEmbedSingle *single;
@@ -197,11 +178,6 @@ ephy_shell_init (EphyShell *gs)
single = ephy_embed_shell_get_embed_single (EPHY_EMBED_SHELL (gs));
if (single != NULL)
{
- g_signal_connect (G_OBJECT (single),
- "new_window_orphan",
- G_CALLBACK(ephy_shell_new_window_cb),
- NULL);
-
ephy_init_services (gs);
}
else
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 35a6a09cc..a2c4f1c65 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -952,13 +952,8 @@ ephy_tab_size_to_cb (EphyEmbed *embed, gint width, gint height,
* has been resized. It appears to be the only way
* to have the window sized according to embed
* size correctly.
- * We dont do it for XUL dialogs because in that case
- * a "forced" requisition appear correct.
*/
- if (!(chromemask & EMBED_CHROME_OPENASCHROME))
- {
- g_idle_add (let_me_resize_hack, embed);
- }
+ g_idle_add (let_me_resize_hack, embed);
}
}
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 3b81ede9e..c93689f54 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1573,7 +1573,6 @@ translate_default_chrome (EmbedChromeMask *chrome_mask)
EMBED_CHROME_WINDOWLOWERED |
EMBED_CHROME_CENTERSCREEN |
EMBED_CHROME_OPENASDIALOG |
- EMBED_CHROME_OPENASCHROME |
EMBED_CHROME_OPENASPOPUP);
/* Load defaults */