[gnome-builder] spellchecker: enable ignore/ignore all before we have counted words



commit eb5dd7c94ff918b8111d3190a9da8ad48f732107
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Sun Jul 30 12:34:17 2017 +0200

    spellchecker: enable ignore/ignore all before we have counted words
    
    When we show the spellchecker panel, the words occurences
    are not counted yet but we still need to be able to use
    ignore/ignore all

 plugins/spellcheck/gbp-spell-widget-actions.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/plugins/spellcheck/gbp-spell-widget-actions.c b/plugins/spellcheck/gbp-spell-widget-actions.c
index b51cb15..67d0bbe 100644
--- a/plugins/spellcheck/gbp-spell-widget-actions.c
+++ b/plugins/spellcheck/gbp-spell-widget-actions.c
@@ -20,6 +20,7 @@
 #define G_LOG_DOMAIN "gbp-spell-widget-actions"
 
 #include "gbp-spell-dict.h"
+#include "gbp-spell-navigator.h"
 #include "gbp-spell-private.h"
 
 static void
@@ -123,6 +124,8 @@ _gbp_spell_widget_init_actions (GbpSpellWidget *self)
 void
 _gbp_spell_widget_update_actions (GbpSpellWidget *self)
 {
+  GspellNavigator *navigator = NULL;
+  gboolean word_counted = FALSE;
   gboolean can_change = FALSE;
   gboolean can_change_all = FALSE;
   gboolean can_ignore = FALSE;
@@ -141,8 +144,21 @@ _gbp_spell_widget_update_actions (GbpSpellWidget *self)
       can_change_all = TRUE;
       can_move_next_word = TRUE;
 
-      can_ignore = self->current_word_count > 0;
-      can_ignore_all = self->current_word_count > 1;
+      if (self->editor_view_addin != NULL)
+        {
+          if (NULL != (navigator = gbp_spell_editor_view_addin_get_navigator (self->editor_view_addin)))
+            word_counted = gbp_spell_navigator_get_is_words_counted (GBP_SPELL_NAVIGATOR (navigator));
+        }
+
+      if (word_counted)
+        {
+          can_ignore = self->current_word_count > 0;
+          can_ignore_all = self->current_word_count > 1;
+        }
+      else
+        {
+          can_ignore = can_ignore_all = TRUE;
+        }
     }
 
   dzl_gtk_widget_action_set (GTK_WIDGET (self), "spell-widget", "change",


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