From 96b61f1e2c50ce20423136738e1a3e0a9d7364dc Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sat, 30 Oct 2004 17:46:05 +0000 Subject: When showing a modal alert put up by a web page, switch the window to that 2004-10-30 Christian Persch * configure.ac: * embed/ephy-embed.c: (ephy_embed_base_init): * embed/ephy-embed.h: * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: * src/ephy-window.c: (modal_alert_cb), (tab_added_cb), (tab_removed_cb): When showing a modal alert put up by a web page, switch the window to that tab. --- src/ephy-window.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/ephy-window.c') diff --git a/src/ephy-window.c b/src/ephy-window.c index 73495a6fd..4be634d05 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1957,11 +1957,34 @@ update_tabs_menu_sensitivity (EphyWindow *window) g_object_set (action, "sensitive", detach, NULL); } +static gboolean +modal_alert_cb (EphyEmbed *embed, + EphyWindow *window) +{ + EphyTab *tab; + char *address; + + tab = ephy_tab_for_embed (embed); + g_return_val_if_fail (tab != NULL, FALSE); + + ephy_window_jump_to_tab (window, tab); + + /* make sure the location entry shows the real URL of the tab's page */ + address = ephy_embed_get_location (embed, TRUE); + toolbar_set_location (window->priv->toolbar, address); + g_free (address); + + /* don't suppress alert */ + return FALSE; +} + static void tab_added_cb (EphyNotebook *notebook, EphyTab *tab, EphyWindow *window) { + EphyEmbed *embed; + g_return_if_fail (EPHY_IS_TAB (tab)); window->priv->num_tabs++; @@ -1970,6 +1993,12 @@ tab_added_cb (EphyNotebook *notebook, g_signal_connect_object (G_OBJECT (tab), "notify::visible", G_CALLBACK (sync_tab_visibility), window, 0); + + embed = ephy_tab_get_embed (tab); + g_return_if_fail (embed != NULL); + + g_signal_connect_after (embed, "ge-modal-alert", + G_CALLBACK (modal_alert_cb), window); } static void @@ -1977,6 +2006,8 @@ tab_removed_cb (EphyNotebook *notebook, EphyTab *tab, EphyWindow *window) { + EphyEmbed *embed; + g_return_if_fail (EPHY_IS_TAB (tab)); g_signal_handlers_disconnect_by_func (G_OBJECT (tab), @@ -1989,6 +2020,12 @@ tab_removed_cb (EphyNotebook *notebook, { update_tabs_menu_sensitivity (window); } + + embed = ephy_tab_get_embed (tab); + g_return_if_fail (embed != NULL); + + g_signal_handlers_disconnect_by_func + (embed, G_CALLBACK (modal_alert_cb), window); } static void -- cgit v1.2.3