[gnome-builder/wip/gtk4-port: 512/1774] 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: 512/1774] plugins/spellcheck: add corrections API to buffer addin
- Date: Mon, 11 Jul 2022 22:31:14 +0000 (UTC)
commit c4d0f3b42ee751e658dd8e6f2012804cf7542ed0
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]