[file-roller/wip/gtk4: 44/54] window: allow to use Ctrl-L to focus the location entry
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller/wip/gtk4: 44/54] window: allow to use Ctrl-L to focus the location entry
- Date: Sun, 2 Oct 2022 17:56:50 +0000 (UTC)
commit 0ffdbeaad4d9a87c8628fe527cf07ad8d6862dc8
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Oct 2 07:59:48 2022 +0200
window: allow to use Ctrl-L to focus the location entry
src/fr-window-actions-callbacks.c | 9 +++++++++
src/fr-window-actions-callbacks.h | 1 +
src/fr-window-actions-entries.h | 7 ++++++-
src/fr-window.c | 9 +++++++++
src/fr-window.h | 2 ++
5 files changed, 27 insertions(+), 1 deletion(-)
---
diff --git a/src/fr-window-actions-callbacks.c b/src/fr-window-actions-callbacks.c
index ae44ec53..1bab4617 100644
--- a/src/fr-window-actions-callbacks.c
+++ b/src/fr-window-actions-callbacks.c
@@ -484,3 +484,12 @@ fr_window_activate_view_sidebar (GSimpleAction *action,
g_object_unref (settings);
}
+
+
+void
+fr_window_activate_focus_location (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ fr_window_focus_location (FR_WINDOW (user_data));
+}
diff --git a/src/fr-window-actions-callbacks.h b/src/fr-window-actions-callbacks.h
index 86575acc..27885bfe 100644
--- a/src/fr-window-actions-callbacks.h
+++ b/src/fr-window-actions-callbacks.h
@@ -62,5 +62,6 @@ DEF_ACTION_CALLBACK (fr_window_activate_test_archive)
DEF_ACTION_CALLBACK (fr_window_activate_view_properties)
DEF_ACTION_CALLBACK (fr_window_activate_view_selection)
DEF_ACTION_CALLBACK (fr_window_activate_view_sidebar)
+DEF_ACTION_CALLBACK (fr_window_activate_focus_location)
#endif /* FR_WINDOW_ACTION_CALLBACKS_H */
diff --git a/src/fr-window-actions-entries.h b/src/fr-window-actions-entries.h
index 528abe86..78206966 100644
--- a/src/fr-window-actions-entries.h
+++ b/src/fr-window-actions-entries.h
@@ -161,6 +161,10 @@ static const GActionEntry fr_window_actions[] = {
.state = "false",
.change_state = fr_window_activate_view_sidebar,
},
+ {
+ .name = "focus-location",
+ .activate = fr_window_activate_focus_location,
+ },
};
@@ -175,7 +179,8 @@ static const FrAccelerator fr_window_accelerators[] = {
{ "win.save-as", "<Shift><Control>s" },
{ "win.select-all", "<control>a" },
{ "win.view-properties", "<alt>Return" },
- { "win.view-sidebar", "F9" }
+ { "win.view-sidebar", "F9" },
+ { "win.focus-location", "<Control>l" }
};
diff --git a/src/fr-window.c b/src/fr-window.c
index 8a329d96..4ef949e9 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -9422,3 +9422,12 @@ fr_window_extract_archive_and_continue (FrWindow *window,
junk_paths,
_fr_window_get_ask_to_open_destination (window));
}
+
+
+void
+fr_window_focus_location (FrWindow *window)
+{
+ FrWindowPrivate *private = fr_window_get_instance_private (window);
+ if (private->list_mode == FR_WINDOW_LIST_MODE_AS_DIR)
+ gtk_widget_grab_focus (private->location_entry);
+}
diff --git a/src/fr-window.h b/src/fr-window.h
index ae399079..d1b69b5f 100644
--- a/src/fr-window.h
+++ b/src/fr-window.h
@@ -436,4 +436,6 @@ void fr_window_extract_archive_and_continue (FrWindow *window,
FrOverwrite overwrite,
gboolean junk_paths);
+void fr_window_focus_location (FrWindow *window);
+
#endif /* FR_WINDOW_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]