[gnome-builder/wip/tingping/keybindings] keybindings: Also bind ctrl+h to toggle replace in search entry
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/tingping/keybindings] keybindings: Also bind ctrl+h to toggle replace in search entry
- Date: Thu, 25 Aug 2016 20:41:08 +0000 (UTC)
commit e432c69ad854a79e935e74b2d4fe09f9cf0e566e
Author: Patrick Griffis <tingping tingping se>
Date: Thu Aug 25 16:40:08 2016 -0400
keybindings: Also bind ctrl+h to toggle replace in search entry
For whatever reason this only applies to the first entry even
though the selector matches both entries
data/keybindings/default.css | 10 +++++++++-
libide/editor/ide-editor-frame-actions.c | 14 ++++++++++----
2 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/data/keybindings/default.css b/data/keybindings/default.css
index 0df4579..4d5a767 100644
--- a/data/keybindings/default.css
+++ b/data/keybindings/default.css
@@ -10,7 +10,7 @@
"hide-completion" () };
bind "<ctrl>f" { "action" ("frame", "find", "3") };
bind "<ctrl>h" { "action" ("frame", "find", "3")
- "action" ("frame", "search-replace", "") };
+ "action" ("frame", "search-replace", "false") };
bind "<ctrl>o" { "action" ("win", "open-with-dialog", "") };
bind "<ctrl>s" { "action" ("view", "save", "") };
bind "<ctrl><shift>s" { "action" ("view", "save-as", "") };
@@ -57,10 +57,18 @@
bind "<ctrl><alt>i" { "reindent" () };
}
+@binding-set search-entries {
+ bind "<ctrl>h" { "action" ("frame", "search-replace", "true") };
+}
+
idesourceviewmode.default {
-gtk-key-bindings: default-ide-source-view;
}
+.gb-search-frame .search {
+ -gtk-key-bindings: search-entries;
+}
+
treeview.project-tree {
-gtk-key-bindings: builder-gb-project-tree;
}
diff --git a/libide/editor/ide-editor-frame-actions.c b/libide/editor/ide-editor-frame-actions.c
index 2fe2bcb..a0e580b 100644
--- a/libide/editor/ide-editor-frame-actions.c
+++ b/libide/editor/ide-editor-frame-actions.c
@@ -93,12 +93,18 @@ ide_editor_frame_actions_search_replace (GSimpleAction *action,
gpointer user_data)
{
IdeEditorFrame *self = user_data;
+ gboolean visible = TRUE;
+ gboolean toggle;
g_assert (IDE_IS_EDITOR_FRAME (self));
- gtk_widget_set_visible (GTK_WIDGET (self->replace_entry), TRUE);
- gtk_widget_set_visible (GTK_WIDGET (self->replace_button), TRUE);
- gtk_widget_set_visible (GTK_WIDGET (self->replace_all_button), TRUE);
+ toggle = g_variant_get_boolean (variant);
+ if (toggle)
+ visible = !gtk_widget_get_visible (GTK_WIDGET (self->replace_entry));
+
+ gtk_widget_set_visible (GTK_WIDGET (self->replace_entry), visible);
+ gtk_widget_set_visible (GTK_WIDGET (self->replace_button), visible);
+ gtk_widget_set_visible (GTK_WIDGET (self->replace_all_button), visible);
}
static void
@@ -400,7 +406,7 @@ ide_editor_frame_actions_replace_confirm (GSimpleAction *action,
static const GActionEntry IdeEditorFrameActions[] = {
{ "find", ide_editor_frame_actions_find, "i" },
- { "search-replace", ide_editor_frame_actions_search_replace },
+ { "search-replace", ide_editor_frame_actions_search_replace, "b" },
{ "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]