fix: save settings when closing (#16)
Reviewed-on: https://codeberg.org/Bavarder/Bavarder/pulls/16
This commit is contained in:
commit
acf8560f11
10
src/main.py
10
src/main.py
|
@ -76,8 +76,8 @@ class BavarderApplication(Adw.Application):
|
|||
# threading.Event()
|
||||
# ) # An event for letting us know when Gst is done playing
|
||||
|
||||
def on_quit(self, action, param):
|
||||
"""Called when the user activates the Quit action."""
|
||||
def quitting(self, _):
|
||||
"""Called before closing main window."""
|
||||
self.settings.set_strv("enabled-providers", list(self.enabled_providers))
|
||||
self.settings.set_string("latest-provider", self.get_provider().slug)
|
||||
|
||||
|
@ -86,6 +86,10 @@ class BavarderApplication(Adw.Application):
|
|||
self.save_providers()
|
||||
self.quit()
|
||||
|
||||
def on_quit(self, action, param):
|
||||
"""Called when the user activates the Quit action."""
|
||||
self.quitting()
|
||||
|
||||
def save_providers(self):
|
||||
r = {}
|
||||
for k, p in self.providers.items():
|
||||
|
@ -114,6 +118,8 @@ class BavarderApplication(Adw.Application):
|
|||
|
||||
self.win.response_stack.set_visible_child_name("page_response")
|
||||
|
||||
self.win.connect("close-request", self.quitting)
|
||||
|
||||
self.provider_selector_model = Gtk.StringList()
|
||||
self.providers = {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user