[latexila] spell: update code to use GtkTextView support of gspell



commit b9e732bfcc430afcff385c0d8fc9b9732e3125ef
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Dec 31 12:35:39 2015 +0100

    spell: update code to use GtkTextView support of gspell
    
    It simplifies a little the code.

 src/document_view.vala |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)
---
diff --git a/src/document_view.vala b/src/document_view.vala
index 46cbea5..6f1508c 100644
--- a/src/document_view.vala
+++ b/src/document_view.vala
@@ -33,14 +33,13 @@ public class DocumentView : Gtk.SourceView
     private GLib.Settings _editor_settings;
     private Pango.FontDescription _font_desc;
 
-    private Gspell.InlineCheckerGtv? _inline_spell_checker = null;
     private static bool _no_spell_language_dialog_shown = false;
 
     public bool highlight_misspelled_words
     {
         get
         {
-            return _inline_spell_checker != null;
+            return Gspell.text_view_get_inline_checking (this);
         }
 
         set
@@ -348,13 +347,9 @@ public class DocumentView : Gtk.SourceView
 
         if (spell_checker.get_language () != null)
         {
-            if (_inline_spell_checker == null)
+            if (! Gspell.text_view_get_inline_checking (this))
             {
-                _inline_spell_checker =
-                    new Gspell.InlineCheckerGtv (this.buffer);
-
-                _inline_spell_checker.attach_view (this);
-
+                Gspell.text_view_set_inline_checking (this, true);
                 notify_property ("highlight-misspelled-words");
             }
 
@@ -396,10 +391,9 @@ public class DocumentView : Gtk.SourceView
 
     private void deactivate_inline_spell_checker ()
     {
-        if (_inline_spell_checker != null)
+        if (Gspell.text_view_get_inline_checking (this))
         {
-            _inline_spell_checker.detach_view (this);
-            _inline_spell_checker = null;
+            Gspell.text_view_set_inline_checking (this, false);
             notify_property ("highlight-misspelled-words");
         }
     }


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