[gnome-builder] plugins/spellcheck: fix language action for spellcheck
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] plugins/spellcheck: fix language action for spellcheck
- Date: Wed, 5 Oct 2022 22:26:58 +0000 (UTC)
commit 057aec4b61149f17a63d4192915bde8eb6603ab7
Author: Christian Hergert <chergert redhat com>
Date: Wed Oct 5 15:26:48 2022 -0700
plugins/spellcheck: fix language action for spellcheck
Fixes #1845
src/plugins/spellcheck/gbp-spell-buffer-addin.c | 13 ++++++++++++-
src/plugins/spellcheck/gbp-spell-buffer-addin.h | 19 ++++++++++---------
src/plugins/spellcheck/gbp-spell-editor-page-addin.c | 2 ++
3 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/src/plugins/spellcheck/gbp-spell-buffer-addin.c b/src/plugins/spellcheck/gbp-spell-buffer-addin.c
index 5cd2c4861..57fc1882c 100644
--- a/src/plugins/spellcheck/gbp-spell-buffer-addin.c
+++ b/src/plugins/spellcheck/gbp-spell-buffer-addin.c
@@ -40,6 +40,7 @@ struct _GbpSpellBufferAddin
EditorSpellChecker *checker;
EditorTextBufferSpellAdapter *adapter;
GPropertyAction *enabled_action;
+ GPropertyAction *language_action;
guint commit_funcs_handler;
guint enabled : 1;
};
@@ -207,11 +208,12 @@ gbp_spell_buffer_addin_load (IdeBufferAddin *addin,
G_CONNECT_SWAPPED);
self->enabled_action = g_property_action_new ("enabled", self, "enabled");
-
g_object_bind_property_full (buffer, "state", self->adapter, "enabled",
G_BINDING_SYNC_CREATE,
state_to_enabled, NULL, self, NULL);
+ self->language_action = g_property_action_new ("language", self->checker, "language");
+
IDE_EXIT;
}
@@ -236,6 +238,7 @@ gbp_spell_buffer_addin_unload (IdeBufferAddin *addin,
g_clear_object (&self->checker);
g_clear_object (&self->adapter);
g_clear_object (&self->enabled_action);
+ g_clear_object (&self->language_action);
self->buffer = NULL;
@@ -416,3 +419,11 @@ gbp_spell_buffer_addin_get_enabled_action (GbpSpellBufferAddin *self)
return G_ACTION (self->enabled_action);
}
+
+GAction *
+gbp_spell_buffer_addin_get_language_action (GbpSpellBufferAddin *self)
+{
+ g_return_val_if_fail (GBP_IS_SPELL_BUFFER_ADDIN (self), NULL);
+
+ return G_ACTION (self->language_action);
+}
diff --git a/src/plugins/spellcheck/gbp-spell-buffer-addin.h b/src/plugins/spellcheck/gbp-spell-buffer-addin.h
index ae0fa3b7a..37cbd85a1 100644
--- a/src/plugins/spellcheck/gbp-spell-buffer-addin.h
+++ b/src/plugins/spellcheck/gbp-spell-buffer-addin.h
@@ -28,14 +28,15 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GbpSpellBufferAddin, gbp_spell_buffer_addin, GBP, SPELL_BUFFER_ADDIN, GObject)
-void gbp_spell_buffer_addin_add_word (GbpSpellBufferAddin *self,
- const char *word);
-void gbp_spell_buffer_addin_ignore_word (GbpSpellBufferAddin *self,
- const char *word);
-gboolean gbp_spell_buffer_addin_check_spelling (GbpSpellBufferAddin *self,
- const char *word);
-char **gbp_spell_buffer_addin_list_corrections (GbpSpellBufferAddin *self,
- const char *word);
-GAction *gbp_spell_buffer_addin_get_enabled_action (GbpSpellBufferAddin *self);
+void gbp_spell_buffer_addin_add_word (GbpSpellBufferAddin *self,
+ const char *word);
+void gbp_spell_buffer_addin_ignore_word (GbpSpellBufferAddin *self,
+ const char *word);
+gboolean gbp_spell_buffer_addin_check_spelling (GbpSpellBufferAddin *self,
+ const char *word);
+char **gbp_spell_buffer_addin_list_corrections (GbpSpellBufferAddin *self,
+ const char *word);
+GAction *gbp_spell_buffer_addin_get_enabled_action (GbpSpellBufferAddin *self);
+GAction *gbp_spell_buffer_addin_get_language_action (GbpSpellBufferAddin *self);
G_END_DECLS
diff --git a/src/plugins/spellcheck/gbp-spell-editor-page-addin.c
b/src/plugins/spellcheck/gbp-spell-editor-page-addin.c
index 64e355c0e..ef315b092 100644
--- a/src/plugins/spellcheck/gbp-spell-editor-page-addin.c
+++ b/src/plugins/spellcheck/gbp-spell-editor-page-addin.c
@@ -225,6 +225,8 @@ gbp_spell_editor_page_addin_load (IdeEditorPageAddin *addin,
self);
g_action_map_add_action (G_ACTION_MAP (self->actions),
gbp_spell_buffer_addin_get_enabled_action (self->buffer_addin));
+ g_action_map_add_action (G_ACTION_MAP (self->actions),
+ gbp_spell_buffer_addin_get_language_action (self->buffer_addin));
g_signal_connect_object (view,
"populate-menu",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]