From eea97b9de2d079295ed6bb2454b5fe367d569b70 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Wed, 2 Feb 2005 19:32:47 +0000 Subject: Add chrome param to ephy_shell_new_tab_full, and use it in 2005-02-02 Christian Persch * src/ephy-automation.c: (impl_ephy_automation_loadUrlWithStartupId): * src/ephy-shell.c: (ephy_shell_new_window_cb), (ephy_shell_new_tab_full), (ephy_shell_new_tab): * src/ephy-shell.h: Add chrome param to ephy_shell_new_tab_full, and use it in ephy_shell_new_window_cb(). Fixes bug #165566. --- src/ephy-automation.c | 2 +- src/ephy-shell.c | 41 +++++++++++++++++++++++++++-------------- src/ephy-shell.h | 4 +++- 3 files changed, 31 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/ephy-automation.c b/src/ephy-automation.c index fac7600d1..99fb8071a 100644 --- a/src/ephy-automation.c +++ b/src/ephy-automation.c @@ -106,7 +106,7 @@ impl_ephy_automation_loadUrlWithStartupId (PortableServer_Servant _servant, } ephy_shell_new_tab_full (ephy_shell, window, NULL, url, flags, - user_time); + EPHY_EMBED_CHROME_ALL, user_time); } static void diff --git a/src/ephy-shell.c b/src/ephy-shell.c index dc9647df5..62e6f5692 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -158,26 +158,33 @@ ephy_shell_new_window_cb (EphyEmbedSingle *single, EphyEmbedChrome chromemask, EphyShell *shell) { + GtkWidget *parent = NULL; EphyTab *new_tab; - EphyWindow *window; + EphyNewTabFlags flags = EPHY_NEW_TAB_DONT_SHOW_WINDOW | + EPHY_NEW_TAB_APPEND_LAST | + EPHY_NEW_TAB_IN_NEW_WINDOW | + EPHY_NEW_TAB_JUMP; 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 (); + chromemask = EPHY_EMBED_CHROME_ALL; } - else + + if (parent_embed != NULL) { - window = ephy_window_new_with_chrome (chromemask); + /* this will either be a EphyWindow, or the embed itself + * (in case it's about to be destroyed, which means it's already + * removed from its tab) + */ + parent = gtk_widget_get_toplevel (GTK_WIDGET (parent_embed)); } - new_tab = ephy_tab_new (); - gtk_widget_show (GTK_WIDGET (new_tab)); - - ephy_window_add_tab (window, new_tab, -1, FALSE); + new_tab = ephy_shell_new_tab_full + (shell, + EPHY_IS_WINDOW (parent) ? EPHY_WINDOW (parent) : NULL, + NULL, NULL, flags, chromemask, 0); return ephy_tab_get_embed (new_tab); } @@ -649,6 +656,7 @@ load_homepage (EphyEmbed *embed) * @parent_window: the target #EphyWindow or %NULL * @previous_tab: the referrer tab or %NULL * @url: an url to load or %NULL + * @chrome: a #EphyEmbedChrome mask to use if creating a new window * @user_time: a timestamp, or 0 * * Create a new tab and the parent window when necessary. @@ -662,6 +670,7 @@ ephy_shell_new_tab_full (EphyShell *shell, EphyTab *previous_tab, const char *url, EphyNewTabFlags flags, + EphyEmbedChrome chrome, guint32 user_time) { EphyWindow *window; @@ -690,7 +699,7 @@ ephy_shell_new_tab_full (EphyShell *shell, } else { - window = ephy_window_new (); + window = ephy_window_new_with_chrome (chrome); } toolbar = EPHY_TOOLBAR (ephy_window_get_toolbar (window)); @@ -715,8 +724,6 @@ ephy_shell_new_tab_full (EphyShell *shell, ephy_gui_window_update_user_time (GTK_WIDGET (window), user_time); - gtk_widget_show (GTK_WIDGET (window)); - if (flags & EPHY_NEW_TAB_HOME_PAGE || flags & EPHY_NEW_TAB_NEW_PAGE) { @@ -730,6 +737,11 @@ ephy_shell_new_tab_full (EphyShell *shell, ephy_embed_load_url (embed, url); } + if ((flags & EPHY_NEW_TAB_DONT_SHOW_WINDOW) == 0) + { + gtk_widget_show (GTK_WIDGET (window)); + } + if (flags & EPHY_NEW_TAB_FULLSCREEN_MODE) { gtk_window_fullscreen (GTK_WINDOW (window)); @@ -758,7 +770,8 @@ ephy_shell_new_tab (EphyShell *shell, EphyNewTabFlags flags) { return ephy_shell_new_tab_full (shell, parent_window, - previous_tab, url, flags, 0); + previous_tab, url, flags, + EPHY_EMBED_CHROME_ALL, 0); } /** diff --git a/src/ephy-shell.h b/src/ephy-shell.h index 84b86d340..32e5f9383 100644 --- a/src/ephy-shell.h +++ b/src/ephy-shell.h @@ -74,13 +74,14 @@ typedef enum /* Page mode */ EPHY_NEW_TAB_FULLSCREEN_MODE = 1 << 4, + EPHY_NEW_TAB_DONT_SHOW_WINDOW = 1 << 5, /* Tabs */ EPHY_NEW_TAB_APPEND_LAST = 1 << 7, EPHY_NEW_TAB_APPEND_AFTER = 1 << 8, EPHY_NEW_TAB_JUMP = 1 << 9, EPHY_NEW_TAB_IN_NEW_WINDOW = 1 << 10, - EPHY_NEW_TAB_IN_EXISTING_WINDOW = 1 << 11 + EPHY_NEW_TAB_IN_EXISTING_WINDOW = 1 << 11, } EphyNewTabFlags; struct _EphyShell @@ -128,6 +129,7 @@ EphyTab *ephy_shell_new_tab_full (EphyShell *shell, EphyTab *previous_tab, const char *url, EphyNewTabFlags flags, + EphyEmbedChrome chrome, guint32 user_time); GObject *ephy_shell_get_session (EphyShell *shell); -- cgit v1.2.3