Philipp Hörist pushed to branch master at gajim / gajim
Commits:
f0e5c049 by Philipp Hörist at 2026-01-07T00:26:36+01:00
cfix: DBMigration: Inherit from Adw.ApplicationWindow
Don't use GajimAppWindow because it defines many things we dont need for this
dialog e.g. shortcuts or storing window size.
Do not set the application on the Window so the window-added signal is not
triggert on the Application instance.
This prevents any shortcuts to be installed.
The DB Migration Dialog is executed during startup, we cannot depend on any
services like settings already being initalized.
- - - - -
2 changed files:
- gajim/gtk/db_migration.py
- test/gtk/ui_test_db_migration.py
Changes:
=====================================
gajim/gtk/db_migration.py
=====================================
@@ -8,6 +8,7 @@
import traceback
from io import StringIO
+from gi.repository import Adw
from gi.repository import GLib
from gi.repository import Gtk
@@ -20,32 +21,35 @@
from gajim.common.i18n import _
from gajim.gtk.builder import get_builder
-from gajim.gtk.window import GajimAppWindow
+from gajim.gtk.util.classes import SignalManager
log = logging.getLogger("gajim.gtk.db_migration")
+# Beware that many services are not initialized in Gajim when this dialog runs
+# This dialog should not access any Gajim settings, or inherit from classes
+# which access Gajim settings.
-class DBMigration(GajimAppWindow, EventHelper):
+
+class DBMigration(Adw.ApplicationWindow, EventHelper, SignalManager):
def __init__(
self,
) -> None:
- GajimAppWindow.__init__(
+ Adw.ApplicationWindow.__init__(
self,
name="DBMigration",
title=_("Database Migration"),
default_width=600,
default_height=300,
- transient_for=app.window,
modal=True,
- header_bar=True,
)
EventHelper.__init__(self)
+ SignalManager.__init__(self)
self.set_deletable(False)
self.set_resizable(False)
self._ui = get_builder("db_migration.ui")
- self.set_child(self._ui.box)
+ self.set_content(self._ui.box)
self._connect(
self._ui.error_copy_button, "clicked", self._on_error_copy_clicked
@@ -56,6 +60,7 @@ def __init__(
self._connect(
self._ui.success_close_button, "clicked",
self._on_close_button_clicked
)
+ self._connect(self, "close-request", self._on_close_request)
self.register_events(
[
@@ -74,9 +79,12 @@ def _set_transient(self) -> int:
self.set_transient_for(app.window)
return GLib.SOURCE_CONTINUE
- def _cleanup(self) -> None:
- GLib.source_remove(self._timeout_id)
+ def _on_close_request(self, _widget: Adw.ApplicationWindow) -> None:
+ log.debug("Initiate Cleanup: %s", self.get_name())
+ self._disconnect_all()
self.unregister_events()
+ GLib.source_remove(self._timeout_id)
+ app.check_finalize(self)
def _on_start(self, event: DBMigrationStart) -> None:
self._ui.stack.set_visible_child_name("progress-page")
=====================================
test/gtk/ui_test_db_migration.py
=====================================
@@ -25,7 +25,7 @@ def __init__(self) -> None:
self._progressing = False
window = DBMigration()
- box = cast(Gtk.Box, util.get_content_widget(window))
+ box = cast(Gtk.Box, window.get_content())
box.set_orientation(Gtk.Orientation.VERTICAL)
button_box = Gtk.Box(spacing=12, halign=Gtk.Align.CENTER)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/f0e5c04908388797a30653d77c33df8f0d5d2fa2
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/f0e5c04908388797a30653d77c33df8f0d5d2fa2
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]