[gspell/wip/inline-checker-gtv: 1/2] utils: don't use GtkSourceView API



commit 74a9da5a0dd3b491f5e9937a479ffbdb7d6949f2
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Dec 13 13:48:30 2015 +0100

    utils: don't use GtkSourceView API
    
    Get the no-spell-check tag by name.

 gspell/gspell-utils.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/gspell/gspell-utils.c b/gspell/gspell-utils.c
index 627e3cd..ce499c7 100644
--- a/gspell/gspell-utils.c
+++ b/gspell/gspell-utils.c
@@ -20,7 +20,6 @@
 
 #include "gspell-utils.h"
 #include <string.h>
-#include <gtksourceview/gtksource.h>
 
 gboolean
 _gspell_utils_is_digit (const gchar *text,
@@ -59,13 +58,27 @@ gboolean
 _gspell_utils_skip_no_spell_check (GtkTextIter       *start,
                                   const GtkTextIter *end)
 {
-       GtkSourceBuffer *buffer = GTK_SOURCE_BUFFER (gtk_text_iter_get_buffer (start));
+       GtkTextBuffer *buffer;
+       GtkTextTagTable *tag_table;
+       GtkTextTag *no_spell_check_tag;
 
-       while (gtk_source_buffer_iter_has_context_class (buffer, start, "no-spell-check"))
+       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");
+
+       if (no_spell_check_tag == NULL)
+       {
+               return TRUE;
+       }
+
+       while (gtk_text_iter_has_tag (start, no_spell_check_tag))
        {
                GtkTextIter last = *start;
 
-               if (!gtk_source_buffer_iter_forward_to_context_class_toggle (buffer, start, "no-spell-check"))
+               if (!gtk_text_iter_forward_to_tag_toggle (start, no_spell_check_tag))
                {
                        return FALSE;
                }


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