[gnome-builder] search: add ctrl+h in Builder keyboard mode
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] search: add ctrl+h in Builder keyboard mode
- Date: Fri, 30 Dec 2016 12:28:37 +0000 (UTC)
commit af35f7b6e0df10f7923c1aa04bde69665b0f17b1
Author: Sébastien Lafargue <slafargue gnome org>
Date: Fri Dec 30 13:20:30 2016 +0100
search: add ctrl+h in Builder keyboard mode
using ctrl+h, you can now trigger the search box
with the replace options opened
There's no equivalent in Vim or emacs mode
This fix also address the followinng bug:
When triggering the search box and toggle the replace options,
next time you show the search box, the replace options
are shown too.
https://bugzilla.gnome.org/show_bug.cgi?id=776599
data/keybindings/default.css | 1 +
libide/editor/ide-editor-frame-actions.c | 26 ++++++++++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/data/keybindings/default.css b/data/keybindings/default.css
index 89e2966..30290e1 100644
--- a/data/keybindings/default.css
+++ b/data/keybindings/default.css
@@ -9,6 +9,7 @@
"clear-snippets" ()
"hide-completion" () };
bind "<ctrl>f" { "action" ("frame", "find", "3") };
+ bind "<ctrl>h" { "action" ("frame", "find-replace", "3") };
bind "<ctrl>o" { "action" ("win", "open-with-dialog", "") };
bind "<ctrl>s" { "action" ("view", "save", "") };
bind "<ctrl><shift>s" { "action" ("view", "save-as", "") };
diff --git a/libide/editor/ide-editor-frame-actions.c b/libide/editor/ide-editor-frame-actions.c
index ed0fda8..a0f1d6b 100644
--- a/libide/editor/ide-editor-frame-actions.c
+++ b/libide/editor/ide-editor-frame-actions.c
@@ -33,6 +33,10 @@ ide_editor_frame_actions_find (GSimpleAction *action,
g_assert (IDE_IS_EDITOR_FRAME (self));
+ gtk_widget_set_visible (GTK_WIDGET (self->replace_entry), FALSE);
+ gtk_widget_set_visible (GTK_WIDGET (self->replace_button), FALSE);
+ gtk_widget_set_visible (GTK_WIDGET (self->replace_all_button), FALSE);
+
search_direction = (GtkDirectionType) g_variant_get_int32 (variant);
ide_source_view_set_search_direction (self->source_view,
search_direction);
@@ -195,6 +199,27 @@ ide_editor_frame_actions_toggle_search_replace (GSimpleAction *action,
}
static void
+ide_editor_frame_actions_find_replace (GSimpleAction *action,
+ GVariant *variant,
+ gpointer user_data)
+{
+ GActionGroup *frame_group;
+ GAction *replace_options_action;
+ g_autoptr (GVariant) replace_options_variant = NULL;
+ IdeEditorFrame *self = user_data;
+
+ g_assert (IDE_IS_EDITOR_FRAME (self));
+
+ if (NULL != (frame_group = gtk_widget_get_action_group (GTK_WIDGET (self->search_frame), "search-entry"))
&&
+ NULL != (replace_options_action = g_action_map_lookup_action (G_ACTION_MAP (frame_group),
"toggle-search-replace")))
+ {
+ replace_options_variant = g_variant_new_boolean (TRUE);
+ ide_editor_frame_actions_find (action, variant, user_data);
+ ide_editor_frame_actions_toggle_search_replace (G_SIMPLE_ACTION (replace_options_action),
replace_options_variant, user_data);
+ }
+}
+
+static void
ide_editor_frame_actions_toggle_search_options (GSimpleAction *action,
GVariant *state,
gpointer user_data)
@@ -386,6 +411,7 @@ ide_editor_frame_actions_replace_confirm (GSimpleAction *action,
static const GActionEntry IdeEditorFrameActions[] = {
{ "find", ide_editor_frame_actions_find, "i" },
+ { "find-replace", ide_editor_frame_actions_find_replace, "i" },
{ "next-search-result", ide_editor_frame_actions_next_search_result },
{ "previous-search-result", ide_editor_frame_actions_previous_search_result },
{ "replace-confirm", ide_editor_frame_actions_replace_confirm, "as" },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]