Improve autostart detection
parent
52bc085681
commit
99b2eb1bd8
|
@ -93,7 +93,8 @@ class ManjaroHello():
|
||||||
self.builder.get_object(img).set_from_file(self.data_path + "img/" + img + ".png")
|
self.builder.get_object(img).set_from_file(self.data_path + "img/" + img + ".png")
|
||||||
|
|
||||||
# Set autostart switcher state
|
# 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
|
# Live systems
|
||||||
if self.infos["live"]:
|
if self.infos["live"]:
|
||||||
|
@ -161,8 +162,7 @@ class ManjaroHello():
|
||||||
os.unlink(self.autostart_path)
|
os.unlink(self.autostart_path)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print(e)
|
print(e)
|
||||||
self.preferences["autostart"] = autostart
|
self.autostart = autostart
|
||||||
self.save_preferences()
|
|
||||||
|
|
||||||
def save_preferences(self):
|
def save_preferences(self):
|
||||||
"""Save preferences in config file."""
|
"""Save preferences in config file."""
|
||||||
|
@ -176,10 +176,7 @@ class ManjaroHello():
|
||||||
"""Read preferences from config file."""
|
"""Read preferences from config file."""
|
||||||
preferences = read_json(self.preferences_path)
|
preferences = read_json(self.preferences_path)
|
||||||
if not preferences:
|
if not preferences:
|
||||||
preferences = {
|
preferences = {"locale": None}
|
||||||
"autostart": os.path.isfile(self.autostart_path),
|
|
||||||
"locale": None
|
|
||||||
}
|
|
||||||
return preferences
|
return preferences
|
||||||
|
|
||||||
def read_page(self, name):
|
def read_page(self, name):
|
||||||
|
|
Loading…
Reference in New Issue