[gnome-text-editor] document: avoid gsettings query when re-enabling spellcheck



commit e6d54dcffef131d09c26bb7855c683eecaa794f4
Author: Christian Hergert <chergert redhat com>
Date:   Mon Aug 1 13:06:03 2022 -0700

    document: avoid gsettings query when re-enabling spellcheck
    
    This makes it work much more like how the highlight-syntax option is done.

 src/editor-document.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/editor-document.c b/src/editor-document.c
index a5d5613..217323c 100644
--- a/src/editor-document.c
+++ b/src/editor-document.c
@@ -84,6 +84,7 @@ typedef struct
   guint            n_active;
 
   guint            highlight_syntax : 1;
+  guint            check_spelling : 1;
   guint            has_draft : 1;
   guint            has_file : 1;
 } Load;
@@ -1403,8 +1404,7 @@ editor_document_query_info_cb (GObject      *object,
   editor_buffer_monitor_reset (self->monitor);
 
   gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (self), load->highlight_syntax);
-  editor_text_buffer_spell_adapter_set_enabled (self->spell_adapter,
-                                                g_settings_get_boolean (shared_settings, "spellcheck"));
+  editor_text_buffer_spell_adapter_set_enabled (self->spell_adapter, load->check_spelling);
 
   _editor_document_unmark_busy (self);
 
@@ -1485,8 +1485,7 @@ editor_document_do_load (EditorDocument *self,
       editor_document_set_busy_progress (self, 1, 2, 1.0);
       _editor_document_unmark_busy (self);
       gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (self), TRUE);
-      editor_text_buffer_spell_adapter_set_enabled (self->spell_adapter,
-                                                    g_settings_get_boolean (shared_settings, "spellcheck"));
+      editor_text_buffer_spell_adapter_set_enabled (self->spell_adapter, load->check_spelling);
       g_task_return_boolean (task, TRUE);
       return;
     }
@@ -1717,6 +1716,8 @@ _editor_document_load_async (EditorDocument      *self,
 
   if (gtk_source_buffer_get_highlight_syntax (GTK_SOURCE_BUFFER (self)))
     load->highlight_syntax = TRUE;
+  load->check_spelling =
+      editor_text_buffer_spell_adapter_get_enabled (self->spell_adapter);
 
   task = g_task_new (self, cancellable, callback, user_data);
   g_task_set_source_tag (task, _editor_document_load_async);


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