From 1b111d590d527d39f169ffcdb5c9f6a0488458f5 Mon Sep 17 00:00:00 2001 From: Juhani Krekelä Date: Sat, 23 Oct 2021 00:33:18 +0300 Subject: Make configuration object accessible outside of load_config Currently the configuration object is located in the function level scope of load_config() and deleted once the function exits. Any flags that control the program behaviour must therefore be copied into separate variables, which pollutes the the upper level namespace. This change keeps the configuration object around after load_config() exits and makes it accessible by other functions from the shared namespace. An upcoming change needs this access. --- terminal.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terminal.vala b/terminal.vala index 1005996..bb66715 100644 --- a/terminal.vala +++ b/terminal.vala @@ -38,6 +38,7 @@ class Terminal : Gtk.Overlay { Gtk.Clipboard primary; Gtk.Settings settings; + Config conf; Gtk.MenuItem[] open_with_items = {}; Pid child_pid; @@ -102,7 +103,7 @@ class Terminal : Gtk.Overlay { } public void load_config(bool reload) { - var conf = new Config(); + conf = new Config(); scrolled_window.set_policy(Gtk.PolicyType.NEVER, get_scrollbar_policy(conf.scrollbar)); -- cgit v1.2.3-2-gb3c3