[evolution/449-support-markdown-in-composer: 13/15] e-spell-text-view: Add functions to enable/disable inline spelling
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/449-support-markdown-in-composer: 13/15] e-spell-text-view: Add functions to enable/disable inline spelling
- Date: Tue, 8 Feb 2022 09:51:57 +0000 (UTC)
commit 6aa411ca58690b50dab90e246a4c678cbbd6431d
Author: Milan Crha <mcrha redhat com>
Date: Mon Feb 7 16:06:02 2022 +0100
e-spell-text-view: Add functions to enable/disable inline spelling
src/e-util/e-spell-text-view.c | 46 ++++++++++++++++++++++++++++++++++++++++++
src/e-util/e-spell-text-view.h | 3 +++
2 files changed, 49 insertions(+)
---
diff --git a/src/e-util/e-spell-text-view.c b/src/e-util/e-spell-text-view.c
index d63a594ef0..ecb22c4c4a 100644
--- a/src/e-util/e-spell-text-view.c
+++ b/src/e-util/e-spell-text-view.c
@@ -103,3 +103,49 @@ e_spell_text_view_attach (GtkTextView *text_view)
gspell_text_view_set_enable_language_menu (spell_view, TRUE);
#endif /* HAVE_GSPELL */
}
+
+/**
+ * e_spell_text_view_get_enabled:
+ * @text_view: a #GtkTextView
+ *
+ * Returns: whether the inline spell checking is enabled for the @text_view.
+ * This can be used only after calling e_spell_text_view_attach().
+ *
+ * Since: 3.44
+ **/
+gboolean
+e_spell_text_view_get_enabled (GtkTextView *text_view)
+{
+#ifdef HAVE_GSPELL
+ GspellTextView *spell_view;
+
+ spell_view = gspell_text_view_get_from_gtk_text_view (text_view);
+
+ return gspell_text_view_get_inline_spell_checking (spell_view);
+#else /* HAVE_GSPELL */
+ return FALSE;
+#endif /* HAVE_GSPELL */
+}
+
+/**
+ * e_spell_text_view_set_enabled:
+ * @text_view: a #GtkTextView
+ * @enabled: value to set
+ *
+ * Sets whether the inline spell checking is enabled for the @text_view.
+ * This can be used only after calling e_spell_text_view_attach().
+ *
+ * Since: 3.44
+ **/
+void
+e_spell_text_view_set_enabled (GtkTextView *text_view,
+ gboolean enabled)
+{
+#ifdef HAVE_GSPELL
+ GspellTextView *spell_view;
+
+ spell_view = gspell_text_view_get_from_gtk_text_view (text_view);
+
+ gspell_text_view_set_inline_spell_checking (spell_view, enabled);
+#endif /* HAVE_GSPELL */
+}
diff --git a/src/e-util/e-spell-text-view.h b/src/e-util/e-spell-text-view.h
index 0d8788eca0..9d0461012b 100644
--- a/src/e-util/e-spell-text-view.h
+++ b/src/e-util/e-spell-text-view.h
@@ -28,6 +28,9 @@ G_BEGIN_DECLS
gboolean e_spell_text_view_is_supported (void);
void e_spell_text_view_attach (GtkTextView *text_view);
+gboolean e_spell_text_view_get_enabled (GtkTextView *text_view);
+void e_spell_text_view_set_enabled (GtkTextView *text_view,
+ gboolean enabled);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]