Daniel Brötzmann pushed to branch db-migration-transient at gajim / gajim
Commits:
28965797 by wurstsalat at 2025-11-10T21:41:30+01:00
fix: DBMigration: Ensure window modality by setting transient periodically
While the DBMigration window is presented, Gajim's main window may not be
present yet (app.window = None). This prevents the DBMigration window
from becoming modal. Setting the transient periodically makes sure modality
is enabled as soon as Gajim's main window is presented.
Fixes #12520
- - - - -
3 changed files:
- gajim/data/gui/db_migration.ui
- gajim/gtk/db_migration.py
- test/gtk/ui_test_db_migration.py
Changes:
=====================================
gajim/data/gui/db_migration.ui
=====================================
@@ -85,6 +85,7 @@ This may take a while…</property>
<object class="GtkScrolledWindow">
<property name="height-request">100</property>
<property name="focusable">1</property>
+ <property name="has-frame">1</property>
<property name="child">
<object class="GtkTextView" id="error_view">
<property name="focusable">1</property>
=====================================
gajim/gtk/db_migration.py
=====================================
@@ -41,6 +41,7 @@ def __init__(
EventHelper.__init__(self)
self.window.set_deletable(False)
+ self.window.set_resizable(False)
self._ui = get_builder("db_migration.ui")
self.set_child(self._ui.box)
@@ -63,7 +64,16 @@ def __init__(
]
)
+ self._timeout_id = GLib.timeout_add(100, self._set_transient)
+
+ def _set_transient(self) -> int:
+ # Set transient on every update to make sure transient is set as
+ # soon as main window is available
+ self.window.set_transient_for(app.window)
+ return GLib.SOURCE_CONTINUE
+
def _cleanup(self) -> None:
+ GLib.source_remove(self._timeout_id)
self.unregister_events()
def _on_progress(self, event: DBMigrationProgress) -> None:
@@ -74,7 +84,7 @@ def _on_progress(self, event: DBMigrationProgress) -> None:
while context.pending():
context.iteration(may_block=False)
- def _on_finished(self, event: DBMigrationFinished) -> None:
+ def _on_finished(self, _event: DBMigrationFinished) -> None:
self._ui.stack.set_visible_child_name("success-page")
GLib.timeout_add_seconds(2, self.present)
=====================================
test/gtk/ui_test_db_migration.py
=====================================
@@ -6,6 +6,7 @@
import time
+from gi.repository import GLib
from gi.repository import Gtk
from gajim.common import app
@@ -43,7 +44,16 @@ def __init__(self) -> None:
window.show()
- def _on_progress_clicked(self, _button: Gtk.Button) -> None:
+ GLib.timeout_add_seconds(3, self._add_window)
+
+ self._progress()
+
+ def _add_window(self) -> None:
+ # Simulate main window becoming available
+ app.window = Gtk.Window(width_request=800, height_request=800)
+ app.window.show()
+
+ def _progress(self) -> None:
self._progressing = True
count = 100000
@@ -55,6 +65,9 @@ def _on_progress_clicked(self, _button: Gtk.Button) -> None:
if i % 1000 == 0:
app.ged.raise_event(DBMigrationProgress(count=count,
progress=i))
+ def _on_progress_clicked(self, _button: Gtk.Button) -> None:
+ self._progress()
+
def _on_finish_clicked(self, _button: Gtk.Button) -> None:
self._progressing = False
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/28965797f0ac92105e311748de3a0b91400f0ea6
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/28965797f0ac92105e311748de3a0b91400f0ea6
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]