From 99b2eb1bd8416c12a0121077b7dc7ef4de3647a1 Mon Sep 17 00:00:00 2001 From: Hugo Posnic Date: Sun, 18 Dec 2016 15:34:43 +0100 Subject: [PATCH] Improve autostart detection --- src/manjaro_hello.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/manjaro_hello.py b/src/manjaro_hello.py index f4ebd89..05878ce 100644 --- a/src/manjaro_hello.py +++ b/src/manjaro_hello.py @@ -93,7 +93,8 @@ class ManjaroHello(): self.builder.get_object(img).set_from_file(self.data_path + "img/" + img + ".png") # Set autostart switcher state - self.builder.get_object("autostart").set_active(self.preferences["autostart"]) + self.autostart = os.path.isfile(self.autostart_path) + self.builder.get_object("autostart").set_active(self.autostart) # Live systems if self.infos["live"]: @@ -161,8 +162,7 @@ class ManjaroHello(): os.unlink(self.autostart_path) except OSError as e: print(e) - self.preferences["autostart"] = autostart - self.save_preferences() + self.autostart = autostart def save_preferences(self): """Save preferences in config file.""" @@ -176,10 +176,7 @@ class ManjaroHello(): """Read preferences from config file.""" preferences = read_json(self.preferences_path) if not preferences: - preferences = { - "autostart": os.path.isfile(self.autostart_path), - "locale": None - } + preferences = {"locale": None} return preferences def read_page(self, name):