[epiphany] Set focus to entry for no show addresses
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Set focus to entry for no show addresses
- Date: Sat, 11 Jan 2020 15:04:34 +0000 (UTC)
commit 7a4e510e5b4318522daaa07680bdb71976e5ee1a
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Sat Jan 11 12:38:34 2020 +0100
Set focus to entry for no show addresses
src/ephy-session.c | 1 +
src/ephy-window.c | 22 ++++++++++++++++++++++
src/ephy-window.h | 3 +++
3 files changed, 26 insertions(+)
---
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 081750b0c..d4fc4d2e1 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -1295,6 +1295,7 @@ session_end_element (GMarkupParseContext *ctx,
active_child = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (context->window));
gtk_widget_grab_focus (GTK_WIDGET (active_child));
+ ephy_window_update_entry_focus (context->window, ephy_embed_get_web_view (active_child));
gtk_widget_show (GTK_WIDGET (context->window));
}
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 68a727581..59f0e661f 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -3016,6 +3016,26 @@ real_get_active_tab (EphyWindow *window,
return EPHY_EMBED (embed);
}
+void
+ephy_window_update_entry_focus (EphyWindow *window,
+ EphyWebView *view)
+{
+ GtkWidget *title_widget;
+ EphyLocationEntry *lentry;
+ GtkWidget *entry;
+ const char *address = NULL;
+
+ address = ephy_web_view_get_address (view);
+ if (!ephy_embed_utils_is_no_show_address (address) && !ephy_web_view_is_overview (view))
+ return;
+
+ title_widget = GTK_WIDGET (ephy_header_bar_get_title_widget (EPHY_HEADER_BAR (window->header_bar)));
+ lentry = EPHY_LOCATION_ENTRY (title_widget);
+ entry = ephy_location_entry_get_entry (lentry);
+
+ gtk_entry_grab_focus_without_selecting (GTK_ENTRY (entry));
+}
+
static void
notebook_switch_page_cb (GtkNotebook *notebook,
GtkWidget *page,
@@ -3045,6 +3065,8 @@ notebook_switch_page_cb (GtkNotebook *notebook,
g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_uint32 (page_num));
update_reader_mode (window, view);
+
+ ephy_window_update_entry_focus (window, view);
}
static void
diff --git a/src/ephy-window.h b/src/ephy-window.h
index 18a75456a..32cab7595 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -84,4 +84,7 @@ void ephy_window_show_fullscreen_header_bar (EphyWindow *window);
int ephy_window_get_position_for_new_embed (EphyWindow *window,
EphyEmbed *embed);
+void ephy_window_update_entry_focus (EphyWindow *window,
+ EphyWebView *view);
+
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]