[epiphany] Complete URL with <Tab>
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Complete URL with <Tab>
- Date: Wed, 15 Jan 2020 17:35:04 +0000 (UTC)
commit f2639c52f06d52538fb00f4e14cee611aa9bc2f6
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Sat May 4 10:54:35 2019 +0200
Complete URL with <Tab>
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/705
lib/widgets/ephy-location-entry.c | 49 +++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 944e456a6..43d0f3fdc 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -864,6 +864,36 @@ leave_notify_cb (GtkWidget *widget,
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_PRELIGHT);
}
+static void
+handle_forward_tab_key (GtkWidget *widget,
+ gpointer user_data)
+{
+ EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (user_data);
+ GtkWidget *popover;
+
+ popover = dzl_suggestion_entry_get_popover (DZL_SUGGESTION_ENTRY (entry->url_entry));
+ if (gtk_widget_is_visible (popover)) {
+ g_signal_emit_by_name (entry->url_entry, "move-suggestion", 1, G_TYPE_INT, 1, G_TYPE_NONE);
+ } else {
+ gtk_widget_child_focus (gtk_widget_get_toplevel (GTK_WIDGET (entry)), GTK_DIR_TAB_FORWARD);
+ }
+}
+
+static void
+handle_backward_tab_key (GtkWidget *widget,
+ gpointer user_data)
+{
+ EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (user_data);
+ GtkWidget *popover;
+
+ popover = dzl_suggestion_entry_get_popover (DZL_SUGGESTION_ENTRY (entry->url_entry));
+ if (gtk_widget_is_visible (popover)) {
+ g_signal_emit_by_name (entry->url_entry, "move-suggestion", -1, G_TYPE_INT, 1, G_TYPE_NONE);
+ } else {
+ gtk_widget_child_focus (gtk_widget_get_toplevel (GTK_WIDGET (entry)), GTK_DIR_TAB_BACKWARD);
+ }
+}
+
static void
position_func (DzlSuggestionEntry *self,
GdkRectangle *area,
@@ -920,6 +950,7 @@ ephy_location_entry_construct_contents (EphyLocationEntry *entry)
GtkWidget *event;
GtkWidget *box;
GtkStyleContext *context;
+ DzlShortcutController *controller;
LOG ("EphyLocationEntry constructing contents %p", entry);
@@ -1004,6 +1035,24 @@ ephy_location_entry_construct_contents (EphyLocationEntry *entry)
g_signal_connect (entry->url_entry, "suggestion-activated",
G_CALLBACK (ephy_location_entry_suggestion_activated), entry);
+
+
+ controller = dzl_shortcut_controller_find (entry->url_entry);
+ dzl_shortcut_controller_add_command_callback (controller,
+ "org.gnome.Epiphany.complete-url-forward",
+ "Tab",
+ DZL_SHORTCUT_PHASE_DISPATCH,
+ handle_forward_tab_key,
+ entry,
+ NULL);
+
+ dzl_shortcut_controller_add_command_callback (controller,
+ "org.gnome.Epiphany.complete-url-backward",
+ "ISO_Left_Tab",
+ DZL_SHORTCUT_PHASE_DISPATCH,
+ handle_backward_tab_key,
+ entry,
+ NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]