[gnome-builder] spellcheck: move to DzlShortcut classes
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] spellcheck: move to DzlShortcut classes
- Date: Tue, 15 Aug 2017 22:46:17 +0000 (UTC)
commit 026d194bebaed228e87c397e522e7f75117cb07e
Author: Sebastien Lafargue <slafargue gnome org>
Date: Wed Aug 16 00:44:45 2017 +0200
spellcheck: move to DzlShortcut classes
data/keybindings/default.css | 1 -
data/keybindings/vim.css | 3 --
plugins/spellcheck/gbp-spell-editor-view-addin.c | 27 ++++++++++++++++++++++
3 files changed, 27 insertions(+), 4 deletions(-)
---
diff --git a/data/keybindings/default.css b/data/keybindings/default.css
index 1598479..0f7fb42 100644
--- a/data/keybindings/default.css
+++ b/data/keybindings/default.css
@@ -42,7 +42,6 @@
bind "F4" { "action" ("win", "find-other-file", "") };
bind "<ctrl><alt>i" { "reindent" () };
- bind "<shift>F7" { "action" ("spellcheck", "spellcheck", "") };
}
idesourceviewmode.default {
diff --git a/data/keybindings/vim.css b/data/keybindings/vim.css
index a313213..826bf21 100644
--- a/data/keybindings/vim.css
+++ b/data/keybindings/vim.css
@@ -110,9 +110,6 @@
bind "<ctrl><shift>d" { "add-cursor" (match) };
bind "F4" { "action" ("win", "find-other-file", "") };
-
- /* start spell checking */
- bind "<shift>F7" { "action" ("spellcheck", "spellcheck", "") };
}
@binding-set builder-vim-source-view-normal-with-count
diff --git a/plugins/spellcheck/gbp-spell-editor-view-addin.c
b/plugins/spellcheck/gbp-spell-editor-view-addin.c
index 221f5f8..a44282d 100644
--- a/plugins/spellcheck/gbp-spell-editor-view-addin.c
+++ b/plugins/spellcheck/gbp-spell-editor-view-addin.c
@@ -19,6 +19,10 @@
#define G_LOG_DOMAIN "gbp-spell-editor-view-addin"
+#include "config.h"
+
+#include <dazzle.h>
+
#include <gspell/gspell.h>
#include <glib/gi18n.h>
@@ -31,6 +35,8 @@
#define SPELLCHECKER_SUBREGION_LENGTH 500
+#define I_(s) g_intern_static_string(s)
+
struct _GbpSpellEditorViewAddin
{
GObject parent_instance;
@@ -88,6 +94,14 @@ static const GActionEntry actions[] = {
{ "cancel-spellcheck", gbp_spell_editor_view_addin_cancel },
};
+ static const DzlShortcutEntry spellchecker_shortcut_entry[] = {
+ { "org.gnome.builder.editor-view.spellchecker",
+ 0, NULL,
+ NC_("shortcut window", "Editor shortcuts"),
+ NC_("shortcut window", "Editing"),
+ NC_("shortcut window", "Show the spellchecker panel") },
+ };
+
static void
gbp_spell_editor_view_addin_load (IdeEditorViewAddin *addin,
IdeEditorView *view)
@@ -95,6 +109,7 @@ gbp_spell_editor_view_addin_load (IdeEditorViewAddin *addin,
GbpSpellEditorViewAddin *self = (GbpSpellEditorViewAddin *)addin;
g_autoptr(GSimpleActionGroup) group = NULL;
g_autoptr(GPropertyAction) enabled_action = NULL;
+ DzlShortcutController *controller;
IdeBufferAddin *buffer_addin;
GspellTextView *wrapper;
IdeSourceView *source_view;
@@ -135,6 +150,18 @@ gbp_spell_editor_view_addin_load (IdeEditorViewAddin *addin,
g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (enabled_action));
g_action_map_add_action_entries (G_ACTION_MAP (group), actions, G_N_ELEMENTS (actions), self);
gtk_widget_insert_action_group (GTK_WIDGET (view), "spellcheck", G_ACTION_GROUP (group));
+
+ controller = dzl_shortcut_controller_find (GTK_WIDGET (view));
+ dzl_shortcut_controller_add_command_action (controller,
+ "org.gnome.builder.editor-view.spellchecker",
+ I_("<shift>F7"),
+ DZL_SHORTCUT_PHASE_CAPTURE,
+ "spellcheck.spellcheck");
+
+ dzl_shortcut_manager_add_shortcut_entries (NULL,
+ spellchecker_shortcut_entry,
+ G_N_ELEMENTS (spellchecker_shortcut_entry),
+ GETTEXT_PACKAGE);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]