Philipp Hörist pushed to branch master at gajim / gajim

Commits:
3fbce778 by Philipp Hörist at 2018-03-07T19:39:33+01:00
Add transient argument to Dialogs

- - - - -


1 changed file:

- gajim/dialogs.py


Changes:

=====================================
gajim/dialogs.py
=====================================
--- a/gajim/dialogs.py
+++ b/gajim/dialogs.py
@@ -230,7 +230,7 @@ class PassphraseDialog:
     Class for Passphrase dialog
     """
     def __init__(self, titletext, labeltext, checkbuttontext=None,
-    ok_handler=None, cancel_handler=None):
+    ok_handler=None, cancel_handler=None, transient_for=None):
         self.xml = gtkgui_helpers.get_gtk_builder('passphrase_dialog.ui')
         self.window = self.xml.get_object('passphrase_dialog')
         self.passphrase_entry = self.xml.get_object('passphrase_entry')
@@ -248,7 +248,9 @@ class PassphraseDialog:
         cancelbutton.connect('clicked', self.on_cancelbutton_clicked)
 
         self.xml.connect_signals(self)
-        self.window.set_transient_for(app.interface.roster.window)
+        if transient_for is None:
+            transient_for = app.app.get_active_window()
+        self.window.set_transient_for(transient_for)
         self.window.show_all()
 
         self.check = bool(checkbuttontext)
@@ -1856,15 +1858,13 @@ class ConfirmationDialogDoubleRadio(ConfirmationDialog):
     """
 
     def __init__(self, pritext, sectext='', radiotext1='', radiotext2='',
-    on_response_ok=None, on_response_cancel=None, is_modal=True):
+    on_response_ok=None, on_response_cancel=None, is_modal=True, 
transient_for=None):
         self.user_response_ok = on_response_ok
         self.user_response_cancel = on_response_cancel
 
-        if hasattr(app.interface, 'roster') and app.interface.roster:
-            parent = app.interface.roster.window
-        else:
-            parent = None
-        HigDialog.__init__(self, parent, Gtk.MessageType.QUESTION,
+        if transient_for is None:
+            transient_for = app.app.get_active_window()
+        HigDialog.__init__(self, transient_for, Gtk.MessageType.QUESTION,
                 Gtk.ButtonsType.OK_CANCEL, pritext, sectext, 
self.on_response_ok,
                 self.on_response_cancel)
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/3fbce778185727fed3bd18d6b28e2b33ca84e755

---
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/3fbce778185727fed3bd18d6b28e2b33ca84e755
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to