diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-01-30 23:20:36 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-01-30 23:20:36 +0800 |
commit | 8f01817138c1852b319898a5de3f4b9f244cdea5 (patch) | |
tree | 3473088e9fc4b6200a85e6714183e6f8482b2963 /src | |
parent | 58dba74abaf6313221c50629e546dc4492672486 (diff) | |
download | gsoc2013-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 'src')
-rw-r--r-- | src/ephy-shell.c | 42 | ||||
-rw-r--r-- | src/ephy-tab.c | 27 |
2 files changed, 43 insertions, 26 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 1fc08162a..9af0c98e5 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -45,6 +45,7 @@ #include "ephy-toolbar.h" #include "ephy-automation.h" #include "print-dialog.h" +#include "ephy-prefs.h" #ifdef ENABLE_DBUS #include "ephy-dbus.h" @@ -150,6 +151,37 @@ ephy_shell_class_init (EphyShellClass *klass) g_type_class_add_private (object_class, sizeof(EphyShellPrivate)); } +static EphyEmbed * +ephy_shell_new_window_cb (EphyEmbedSingle *single, + EphyEmbed *parent_embed, + EphyEmbedChrome chromemask, + EphyShell *shell) +{ + EphyTab *new_tab; + EphyWindow *window; + + LOG ("ephy_shell_new_window_cb tab chrome %d", chromemask); + + /* FIXME in lockdown-fullscreen mode, always add a new tab instead */ + + if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_JAVASCRIPT_CHROME)) + { + window = ephy_window_new (); + } + else + { + window = ephy_window_new_with_chrome (chromemask); + } + + new_tab = ephy_tab_new (); + gtk_widget_show (GTK_WIDGET (new_tab)); + + ephy_window_add_tab (window, new_tab, -1, FALSE); + + return ephy_tab_get_embed (new_tab); +} + + static gboolean ephy_shell_add_sidebar_cb (EphyEmbedSingle *embed_single, const char *url, @@ -189,18 +221,20 @@ ephy_shell_add_sidebar_cb (EphyEmbedSingle *embed_single, static GObject* impl_get_embed_single (EphyEmbedShell *embed_shell) { - EphyShell *shell; + EphyShell *shell = EPHY_SHELL (embed_shell); GObject *embed_single; embed_single = EPHY_EMBED_SHELL_CLASS (parent_class)->get_embed_single (embed_shell); - shell = EPHY_SHELL (embed_shell); - if (embed_single != NULL && shell->priv->embed_single_connected == FALSE) { + g_signal_connect_object (embed_single, "new-window", + G_CALLBACK (ephy_shell_new_window_cb), + shell, G_CONNECT_AFTER); + g_signal_connect_object (embed_single, "add-sidebar", G_CALLBACK (ephy_shell_add_sidebar_cb), - embed_shell, G_CONNECT_AFTER); + shell, G_CONNECT_AFTER); shell->priv->embed_single_connected = TRUE; } diff --git a/src/ephy-tab.c b/src/ephy-tab.c index 009dbe2e3..b4de9b701 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -63,8 +63,6 @@ #define EPHY_TAB_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TAB, EphyTabPrivate)) -#define CONF_LOCKDOWN_DISABLE_JAVASCRIPT_CHROME "/apps/epiphany/lockdown/disable_javascript_chrome" - #define MAX_HIDDEN_POPUPS 5 struct _EphyTabPrivate @@ -1326,34 +1324,19 @@ ephy_tab_net_state_cb (EphyEmbed *embed, build_progress_from_requests (tab, state); } -static EphyEmbed * +static void ephy_tab_new_window_cb (EphyEmbed *embed, - EphyEmbedChrome chromemask, + EphyEmbed *new_embed, EphyTab *tab) { - EphyTab *new_tab; EphyWindow *window; - LOG ("ephy_tab_new_window_cb tab %p with parent %p chrome %d", - tab, ((GtkWidget *) tab)->parent, chromemask); + g_return_if_fail (new_embed != NULL); - if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_JAVASCRIPT_CHROME)) - { - window = ephy_window_new (); - } - else - { - window = ephy_window_new_with_chrome (chromemask); - } - - new_tab = ephy_tab_new (); - gtk_widget_show (GTK_WIDGET (new_tab)); - - ephy_window_add_tab (window, new_tab, -1, FALSE); + window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (new_embed))); + g_return_if_fail (window != NULL); popups_manager_add_window (tab, window); - - return ephy_tab_get_embed (new_tab); } static void |