[gnome-builder/wip/gtk4-port: 527/736] plugins/spellcheck: add corrections API to buffer addin
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 527/736] plugins/spellcheck: add corrections API to buffer addin
- Date: Tue, 26 Apr 2022 01:46:30 +0000 (UTC)
commit 6ed064d04922b2277dfa551abecd1551a788b6de
Author: Christian Hergert <chergert redhat com>
Date: Thu Apr 7 17:36:42 2022 -0700
plugins/spellcheck: add corrections API to buffer addin
src/plugins/spellcheck/gbp-spell-buffer-addin.c | 24 ++++++++++++++++++++++++
src/plugins/spellcheck/gbp-spell-buffer-addin.h | 12 ++++++++----
2 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/spellcheck/gbp-spell-buffer-addin.c b/src/plugins/spellcheck/gbp-spell-buffer-addin.c
index 3f44d1f0f..691909d22 100644
--- a/src/plugins/spellcheck/gbp-spell-buffer-addin.c
+++ b/src/plugins/spellcheck/gbp-spell-buffer-addin.c
@@ -180,3 +180,27 @@ gbp_spell_buffer_addin_ignore_word (GbpSpellBufferAddin *self,
IDE_EXIT;
}
+
+gboolean
+gbp_spell_buffer_addin_check_spelling (GbpSpellBufferAddin *self,
+ const char *word)
+{
+ g_return_val_if_fail (GBP_IS_SPELL_BUFFER_ADDIN (self), FALSE);
+
+ if (self->checker != NULL && word != NULL)
+ return editor_spell_checker_check_word (self->checker, word, -1);
+
+ return TRUE;
+}
+
+char **
+gbp_spell_buffer_addin_list_corrections (GbpSpellBufferAddin *self,
+ const char *word)
+{
+ g_return_val_if_fail (GBP_IS_SPELL_BUFFER_ADDIN (self), NULL);
+
+ if (self->checker != NULL && word != NULL)
+ return editor_spell_checker_list_corrections (self->checker, word);
+
+ return NULL;
+}
diff --git a/src/plugins/spellcheck/gbp-spell-buffer-addin.h b/src/plugins/spellcheck/gbp-spell-buffer-addin.h
index 0a8dd86cc..657f90e9d 100644
--- a/src/plugins/spellcheck/gbp-spell-buffer-addin.h
+++ b/src/plugins/spellcheck/gbp-spell-buffer-addin.h
@@ -28,9 +28,13 @@ 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);
+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);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]