feat: rework preferences
Some checks failed
Build / Flatpak (x86_64) (push) Failing after 6m48s

This commit is contained in:
0xMRTT 2023-05-25 20:47:42 +02:00
parent fde6a5cb0a
commit fa9c41e131
Signed by: 0xMRTT
GPG Key ID: 910B287304120902
2 changed files with 19 additions and 5 deletions

View File

@ -372,7 +372,7 @@ Current Provider: {self.provider}
def on_preferences_action(self, widget, *args, **kwargs):
"""Callback for the app.preferences action."""
preferences = Preferences(
application=self, transient_for=self.props.active_window
parent=self.win
)
preferences.present()

View File

@ -1,4 +1,6 @@
from gi.repository import Gtk, Adw
from gi.repository import Gtk, Adw, Gio
from bavarder.constants import app_id
from bavarder.providers import PROVIDERS
@ -13,11 +15,23 @@ class Preferences(Adw.PreferencesWindow):
close_all_without_dialog_switch = Gtk.Template.Child()
allow_remote_fetching_switch = Gtk.Template.Child()
def __init__(self, application, **kwargs):
def __init__(self, parent, **kwargs):
super().__init__(**kwargs)
self.app = application
self.settings = application.settings
self.parent = parent
self.settings = parent.settings
self.app = self.parent.get_application()
self.win = self.app.get_active_window()
self.set_transient_for(self.win)
self.setup()
def setup(self):
self.setup_signals()
def setup_signals(self):
self.clear_after_send_switch.set_active(self.app.clear_after_send)
self.clear_after_send_switch.connect(