From 8d4fdd9a0f51f292db61ecfbdfc7d1b617adaf7a Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Tue, 26 Jul 2005 14:41:39 +0000 Subject: Fix ESC behaviour to always stop, and to reset the location entry when 2005-07-24 Christian Persch * data/ui/epiphany-ui.xml: * lib/widgets/ephy-location-entry.c: (ephy_location_entry_finalize), (update_address_state), (update_favicon), (editable_changed_cb), (entry_button_press_cb), (match_selected_cb), (entry_key_press_cb), (ephy_location_entry_construct_contents), (ephy_location_entry_set_location), (ephy_location_entry_reset), (ephy_location_entry_set_favicon): * lib/widgets/ephy-location-entry.h: * src/ephy-location-action.c: (entry_activate_cb), (user_changed_cb), (sync_address), (connect_proxy), (ephy_location_action_set_property), (ephy_location_action_finalize), (ephy_location_action_set_address): * src/ephy-location-action.h: * src/ephy-lockdown.c: (update_location_editable): * src/ephy-tab.c: (ephy_tab_get_typed_address): * src/ephy-toolbar.c: (ephy_toolbar_set_location): * src/ephy-toolbar.h: * src/ephy-window.c: (ephy_window_key_press_event), (sync_tab_address), (ephy_window_set_active_tab), (modal_alert_cb): * src/epiphany.defs: * src/window-commands.c: (window_cmd_view_stop): Fix ESC behaviour to always stop, and to reset the location entry when it's focused only. Reset the location entry favicon to the stock icon when the address shown is != the tab's address. When switching tab, preserve the selection if it was owned by the location entry. Fixes bug #155824. --- src/ephy-window.c | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) (limited to 'src/ephy-window.c') diff --git a/src/ephy-window.c b/src/ephy-window.c index e474f75b2..b6d5955da 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -200,6 +200,8 @@ static const GtkActionEntry ephy_menu_entries [] = { { "ViewStop", GTK_STOCK_STOP, N_("_Stop"), "Escape", N_("Stop current data transfer"), G_CALLBACK (window_cmd_view_stop) }, + { "ViewAlwaysStop", GTK_STOCK_STOP, N_("_Stop"), "Escape", + NULL, G_CALLBACK (window_cmd_view_stop) }, { "ViewReload", GTK_STOCK_REFRESH, N_("_Reload"), "R", N_("Display the latest content of the current page"), G_CALLBACK (window_cmd_view_reload) }, @@ -705,6 +707,35 @@ ephy_window_key_press_event (GtkWidget *widget, guint mask = gtk_accelerator_get_default_mod_mask (); char *accel = NULL; + /* Handle ESC here instead of an action callback, so we can + * handle it differently in the location entry, and we can + * stop even when the page is not loading (to stop animations). + */ + if (event->keyval == GDK_Escape && (event->state & mask) == 0) + { + GtkWidget *widget; + EphyEmbed *embed; + gboolean handled = FALSE; + + widget = gtk_window_get_focus (GTK_WINDOW (window)); + + if (GTK_IS_WIDGET (widget)) + { + handled = gtk_widget_event (widget, (GdkEvent*)event); + } + + embed = ephy_window_get_active_embed (window); + if (handled == FALSE && embed != NULL) + { + ephy_embed_activate (embed); + ephy_embed_stop_load (embed); + + handled = TRUE; + } + + return handled; + } + /* Don't activate menubar in ppv mode, or in lockdown mode */ if (window->priv->ppv_mode || eel_gconf_get_boolean (CONF_LOCKDOWN_HIDE_MENUBAR)) { @@ -1114,11 +1145,12 @@ setup_ui_manager (EphyWindow *window) } static void -sync_tab_typed_address (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) +sync_tab_address (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) { if (window->priv->closing) return; ephy_toolbar_set_location (window->priv->toolbar, + ephy_tab_get_address (tab), ephy_tab_get_typed_address (tab)); } @@ -1868,7 +1900,7 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) if (old_tab != NULL) { g_signal_handlers_disconnect_by_func (old_tab, - G_CALLBACK (sync_tab_typed_address), + G_CALLBACK (sync_tab_address), window); g_signal_handlers_disconnect_by_func (old_tab, G_CALLBACK (sync_tab_document_type), @@ -1916,7 +1948,7 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) if (new_tab != NULL) { - sync_tab_typed_address (new_tab, NULL, window); + sync_tab_address (new_tab, NULL, window); sync_tab_document_type (new_tab, NULL, window); sync_tab_icon (new_tab, NULL, window); sync_tab_load_progress (new_tab, NULL, window); @@ -1929,8 +1961,8 @@ ephy_window_set_active_tab (EphyWindow *window, EphyTab *new_tab) sync_tab_title (new_tab, NULL, window); sync_tab_zoom (new_tab, NULL, window); - g_signal_connect_object (new_tab, "notify::typed-address", - G_CALLBACK (sync_tab_typed_address), + g_signal_connect_object (new_tab, "notify::address", + G_CALLBACK (sync_tab_address), window, 0); g_signal_connect_object (new_tab, "notify::document-type", G_CALLBACK (sync_tab_document_type), @@ -2035,7 +2067,7 @@ modal_alert_cb (EphyEmbed *embed, /* make sure the location entry shows the real URL of the tab's page */ address = ephy_embed_get_location (embed, TRUE); - ephy_toolbar_set_location (priv->toolbar, address); + ephy_toolbar_set_location (priv->toolbar, address, NULL); g_free (address); /* don't suppress alert */ -- cgit