[gnome-builder/wip/gtk4-port: 1309/1774] plugins/editorui: ctrl+i to goto-line
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 1309/1774] plugins/editorui: ctrl+i to goto-line
- Date: Mon, 11 Jul 2022 22:31:41 +0000 (UTC)
commit 81980b8e55464b690e89f05c066df66d3ca20311
Author: Christian Hergert <chergert redhat com>
Date: Wed Jun 1 21:54:02 2022 -0700
plugins/editorui: ctrl+i to goto-line
src/plugins/editorui/editorui.gresource.xml | 1 +
src/plugins/editorui/gbp-editorui-workspace-addin.c | 16 ++++++++++++++++
src/plugins/editorui/gtk/keybindings.json | 1 +
3 files changed, 18 insertions(+)
---
diff --git a/src/plugins/editorui/editorui.gresource.xml b/src/plugins/editorui/editorui.gresource.xml
index 4e1907b17..9b7ceea9d 100644
--- a/src/plugins/editorui/editorui.gresource.xml
+++ b/src/plugins/editorui/editorui.gresource.xml
@@ -4,6 +4,7 @@
<file>editorui.plugin</file>
<file>style.css</file>
<file preprocess="xml-stripblanks">gtk/menus.ui</file>
+ <file>gtk/keybindings.json</file>
<file preprocess="xml-stripblanks">gbp-editorui-position-label.ui</file>
</gresource>
</gresources>
diff --git a/src/plugins/editorui/gbp-editorui-workspace-addin.c
b/src/plugins/editorui/gbp-editorui-workspace-addin.c
index 5bc14c16f..40e5731c0 100644
--- a/src/plugins/editorui/gbp-editorui-workspace-addin.c
+++ b/src/plugins/editorui/gbp-editorui-workspace-addin.c
@@ -445,11 +445,27 @@ show_go_to_line_cb (GbpEditoruiWorkspaceAddin *self,
ide_entry_popover_select_all (popover);
}
+static void
+show_go_to_line (GSimpleAction *action,
+ GVariant *param,
+ gpointer user_data)
+{
+ GbpEditoruiWorkspaceAddin *self = user_data;
+
+ g_assert (G_IS_SIMPLE_ACTION (action));
+
+ if (self->page == NULL)
+ return;
+
+ gtk_menu_button_popup (self->position);
+}
+
static const GActionEntry actions[] = {
{ "open-in-new-frame", open_in_new_frame },
{ "open-in-new-workspace", open_in_new_workspace },
{ "new-file", new_file },
{ "new-workspace", new_workspace },
+ { "show-go-to-line", show_go_to_line },
};
static void
diff --git a/src/plugins/editorui/gtk/keybindings.json b/src/plugins/editorui/gtk/keybindings.json
new file mode 100644
index 000000000..f0172b88d
--- /dev/null
+++ b/src/plugins/editorui/gtk/keybindings.json
@@ -0,0 +1 @@
+{ "trigger" : "<Control>i", "action" : "editorui.show-go-to-line", "when" : "canEdit()", "phase" : "capture"
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]