diff --git a/src/main.py b/src/main.py index 07894e4..d060059 100644 --- a/src/main.py +++ b/src/main.py @@ -8,7 +8,7 @@ from gi.repository import GLib, Gio, Gtk, Adw from .conf import * -from .window import SpeedtestWindow, SpeedtestPreferencesWindow +from .window import SpeedtestWindow, SpeedtestPreferencesDialog from .gauge import Gauge # This class isn't used there but it the widget needs to be registered from .fetch_worker import FetchWorker from .test_worker import TestWorker @@ -63,8 +63,7 @@ def load_backend(self): self.fetch_worker.start() def on_about_action(self, widget, __): - about = Adw.AboutWindow(transient_for=self.props.active_window, - application_name=_("Speedtest"), + about = Adw.AboutDialog(application_name=_("Speedtest"), application_icon=APP_ID, developer_name="Ketok", version=VERSION, @@ -75,12 +74,12 @@ def on_about_action(self, widget, __): about.add_credit_section(_("Backend by"), ["Librespeed"]) - about.present() + about.present(self.win) def on_preferences_action(self, widget, _): if self.win.main_view.get_visible_page() == self.win.test_view: # TODO: deactivate this action insead of disabling it return - SpeedtestPreferencesWindow(self, transient_for=self.props.active_window).present() + SpeedtestPreferencesDialog(self).present(self.win) def on_start_action(self, widget, _): self.win.start_test() diff --git a/src/ui/preferences.blp b/src/ui/preferences.blp index 2dec367..f57c9e5 100644 --- a/src/ui/preferences.blp +++ b/src/ui/preferences.blp @@ -1,10 +1,8 @@ using Gtk 4.0; using Adw 1; -template $SpeedtestPreferencesWindow : Adw.PreferencesWindow { +template $SpeedtestPreferencesDialog : Adw.PreferencesDialog { search-enabled: false; - default-width: 360; - default-height: 480; Adw.PreferencesPage { Adw.PreferencesGroup { diff --git a/src/window.py b/src/window.py index 05e02ea..3efb4c5 100644 --- a/src/window.py +++ b/src/window.py @@ -32,8 +32,8 @@ def end_test(self, *_): self.on_test_end() @Gtk.Template(resource_path="/xyz/ketok/Speedtest/ui/preferences.ui") -class SpeedtestPreferencesWindow(Adw.PreferencesWindow): - __gtype_name__ = "SpeedtestPreferencesWindow" +class SpeedtestPreferencesDialog(Adw.PreferencesDialog): + __gtype_name__ = "SpeedtestPreferencesDialog" theme = Gtk.Template.Child() gauge_scale = Gtk.Template.Child()