[gspell/wip/inline-checker-gtv] utils: add get_no_spell_check_tag()



commit b52eddffbdbc58f85520a408268b167c32004747
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Dec 13 14:30:46 2015 +0100

    utils: add get_no_spell_check_tag()

 gspell/gspell-utils.c |   16 +++++++++++++---
 gspell/gspell-utils.h |    3 +++
 2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/gspell/gspell-utils.c b/gspell/gspell-utils.c
index ce499c7..adb73ac 100644
--- a/gspell/gspell-utils.c
+++ b/gspell/gspell-utils.c
@@ -54,20 +54,30 @@ _gspell_utils_is_digit (const gchar *text,
        return TRUE;
 }
 
+GtkTextTag *
+_gspell_utils_get_no_spell_check_tag (GtkTextBuffer *buffer)
+{
+       GtkTextTagTable *tag_table;
+
+       g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), NULL);
+
+       tag_table = gtk_text_buffer_get_tag_table (buffer);
+
+       return gtk_text_tag_table_lookup (tag_table, "gtksourceview:context-classes:no-spell-check");
+}
+
 gboolean
 _gspell_utils_skip_no_spell_check (GtkTextIter       *start,
                                   const GtkTextIter *end)
 {
        GtkTextBuffer *buffer;
-       GtkTextTagTable *tag_table;
        GtkTextTag *no_spell_check_tag;
 
        g_return_val_if_fail (start != NULL, FALSE);
        g_return_val_if_fail (end != NULL, FALSE);
 
        buffer = gtk_text_iter_get_buffer (start);
-       tag_table = gtk_text_buffer_get_tag_table (buffer);
-       no_spell_check_tag = gtk_text_tag_table_lookup (tag_table, 
"gtksourceview:context-classes:no-spell-check");
+       no_spell_check_tag = _gspell_utils_get_no_spell_check_tag (buffer);
 
        if (no_spell_check_tag == NULL)
        {
diff --git a/gspell/gspell-utils.h b/gspell/gspell-utils.h
index 78369a2..7d9e051 100644
--- a/gspell/gspell-utils.h
+++ b/gspell/gspell-utils.h
@@ -30,6 +30,9 @@ gboolean      _gspell_utils_is_digit                  (const gchar *text,
                                                         gssize       text_length);
 
 G_GNUC_INTERNAL
+GtkTextTag *   _gspell_utils_get_no_spell_check_tag    (GtkTextBuffer *buffer);
+
+G_GNUC_INTERNAL
 gboolean       _gspell_utils_skip_no_spell_check       (GtkTextIter       *start,
                                                         const GtkTextIter *end);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]