From bdcb50e499e3a70a3f4ba99d4285707b4baab9e0 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Wed, 28 Jun 2023 10:45:10 +0100 Subject: [PATCH] Handle only relevant settings key changes (#1345) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Corentin Noël --- src/Services/Document.vala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Services/Document.vala b/src/Services/Document.vala index 0ea9df218..d01b5ac75 100644 --- a/src/Services/Document.vala +++ b/src/Services/Document.vala @@ -180,10 +180,11 @@ namespace Scratch.Services { source_map.set_view (source_view); hide_info_bar (); + set_minimap (); + set_strip_trailing_whitespace (); + settings.changed["show-mini-map"].connect (set_minimap); + settings.changed["strip-trailing-on-save"].connect (set_strip_trailing_whitespace); - restore_settings (); - - settings.changed.connect (restore_settings); /* Block user editing while working */ notify["working"].connect (() => { source_view.sensitive = !working; @@ -647,7 +648,7 @@ namespace Scratch.Services { return true; } - private void restore_settings () { + private void set_minimap () { if (Scratch.settings.get_boolean ("show-mini-map")) { source_map.show (); scroll.vscrollbar_policy = Gtk.PolicyType.EXTERNAL; @@ -656,7 +657,9 @@ namespace Scratch.Services { source_map.no_show_all = true; scroll.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC; } + } + private void set_strip_trailing_whitespace () { if (Scratch.settings.get_boolean ("strip-trailing-on-save")) { strip_trailing_spaces (); }