[gedit/wip/spell-checking: 2/3] auto-spell: make recheck_all() private



commit 974445ef733a1c1b54d89477a3f55f82f59c28c2
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Aug 8 12:55:24 2015 +0200

    auto-spell: make recheck_all() private
    
    It's not needed to have it public.

 plugins/spell/gedit-automatic-spell-checker.c |   41 +++++++++++--------------
 plugins/spell/gedit-automatic-spell-checker.h |    2 -
 plugins/spell/gedit-spell-plugin.c            |    2 -
 3 files changed, 18 insertions(+), 27 deletions(-)
---
diff --git a/plugins/spell/gedit-automatic-spell-checker.c b/plugins/spell/gedit-automatic-spell-checker.c
index 5d7c68c..6526f0c 100644
--- a/plugins/spell/gedit-automatic-spell-checker.c
+++ b/plugins/spell/gedit-automatic-spell-checker.c
@@ -416,6 +416,18 @@ add_subregion_to_scan (GeditAutomaticSpellChecker *spell,
 }
 
 static void
+recheck_all (GeditAutomaticSpellChecker *spell)
+{
+       GtkTextIter start;
+       GtkTextIter end;
+
+       gtk_text_buffer_get_bounds (spell->buffer, &start, &end);
+
+       add_subregion_to_scan (spell, &start, &end);
+       check_visible_region (spell);
+}
+
+static void
 insert_text_after_cb (GtkTextBuffer              *buffer,
                      GtkTextIter                *location,
                      gchar                      *text,
@@ -740,7 +752,7 @@ static void
 clear_session_cb (GeditSpellChecker          *checker,
                  GeditAutomaticSpellChecker *spell)
 {
-       gedit_automatic_spell_checker_recheck_all (spell);
+       recheck_all (spell);
 }
 
 static void
@@ -748,7 +760,7 @@ language_notify_cb (GeditSpellChecker          *checker,
                    GParamSpec                 *pspec,
                    GeditAutomaticSpellChecker *spell)
 {
-       gedit_automatic_spell_checker_recheck_all (spell);
+       recheck_all (spell);
 }
 
 /* When the user right-clicks on a word, they want to check that word.
@@ -911,6 +923,8 @@ set_buffer (GeditAutomaticSpellChecker *spell,
        gtk_text_buffer_get_start_iter (spell->buffer, &start);
        spell->mark_click = gtk_text_buffer_create_mark (spell->buffer, NULL, &start, TRUE);
 
+       recheck_all (spell);
+
        g_object_notify (G_OBJECT (spell), "buffer");
 }
 
@@ -1171,6 +1185,8 @@ gedit_automatic_spell_checker_attach_view (GeditAutomaticSpellChecker *spell,
 
        spell->views = g_slist_prepend (spell->views, view);
        g_object_ref (view);
+
+       check_visible_region_in_view (spell, view);
 }
 
 /**
@@ -1195,25 +1211,4 @@ gedit_automatic_spell_checker_detach_view (GeditAutomaticSpellChecker *spell,
        g_object_unref (view);
 }
 
-/**
- * gedit_automatic_spell_checker_recheck_all:
- * @spell: a #GeditAutomaticSpellChecker.
- *
- * Adds the whole buffer to the region to check. But only the visible regions of
- * the attached #GtkTextView's are scanned.
- */
-void
-gedit_automatic_spell_checker_recheck_all (GeditAutomaticSpellChecker *spell)
-{
-       GtkTextIter start;
-       GtkTextIter end;
-
-       g_return_if_fail (GEDIT_IS_AUTOMATIC_SPELL_CHECKER (spell));
-
-       gtk_text_buffer_get_bounds (spell->buffer, &start, &end);
-
-       add_subregion_to_scan (spell, &start, &end);
-       check_visible_region (spell);
-}
-
 /* ex:set ts=8 noet: */
diff --git a/plugins/spell/gedit-automatic-spell-checker.h b/plugins/spell/gedit-automatic-spell-checker.h
index 2d37ea5..acfcffc 100644
--- a/plugins/spell/gedit-automatic-spell-checker.h
+++ b/plugins/spell/gedit-automatic-spell-checker.h
@@ -45,8 +45,6 @@ void  gedit_automatic_spell_checker_attach_view       (GeditAutomaticSpellChecker *spel
 void   gedit_automatic_spell_checker_detach_view       (GeditAutomaticSpellChecker *spell,
                                                         GtkTextView                *view);
 
-void   gedit_automatic_spell_checker_recheck_all       (GeditAutomaticSpellChecker *spell);
-
 #endif  /* __GEDIT_AUTOMATIC_SPELL_CHECKER_H__ */
 
 /* ex:set ts=8 noet: */
diff --git a/plugins/spell/gedit-spell-plugin.c b/plugins/spell/gedit-spell-plugin.c
index b051952..d282ee1 100644
--- a/plugins/spell/gedit-spell-plugin.c
+++ b/plugins/spell/gedit-spell-plugin.c
@@ -435,8 +435,6 @@ set_auto_spell (ViewData *data,
 
                gedit_automatic_spell_checker_attach_view (data->auto_spell,
                                                           GTK_TEXT_VIEW (data->view));
-
-               gedit_automatic_spell_checker_recheck_all (data->auto_spell);
        }
 }
 


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