set a transient_for for join groupchat dialog when needed. Fixes #8994

This commit is contained in:
Yann Leboulanger 2018-03-28 16:14:54 +02:00
parent 16b8eb1fd0
commit a9a6b048fb
3 changed files with 10 additions and 4 deletions

View File

@ -2364,7 +2364,8 @@ class SubscriptionRequestWindow(Gtk.ApplicationWindow):
self.destroy() self.destroy()
class JoinGroupchatWindow(Gtk.ApplicationWindow): class JoinGroupchatWindow(Gtk.ApplicationWindow):
def __init__(self, account, room_jid, password=None, automatic=None): def __init__(self, account, room_jid, password=None, automatic=None,
transient_for=None):
Gtk.ApplicationWindow.__init__(self) Gtk.ApplicationWindow.__init__(self)
self.set_name('JoinGroupchat') self.set_name('JoinGroupchat')
self.set_application(app.app) self.set_application(app.app)
@ -2372,6 +2373,8 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
self.set_resizable(False) self.set_resizable(False)
self.set_position(Gtk.WindowPosition.CENTER) self.set_position(Gtk.WindowPosition.CENTER)
self.set_title(_('Join Groupchat')) self.set_title(_('Join Groupchat'))
if transient_for:
self.set_transient_for(transient_for)
self.automatic = automatic self.automatic = automatic
self.password = password self.password = password

View File

@ -1399,7 +1399,8 @@ class ToplevelAgentBrowser(AgentBrowser):
if not iter_: if not iter_:
return return
service = model[iter_][0] service = model[iter_][0]
app.interface.join_gc_minimal(self.account, service) app.interface.join_gc_minimal(self.account, service,
transient_for=self.window.window)
def update_actions(self): def update_actions(self):
if self.execute_button: if self.execute_button:

View File

@ -1818,7 +1818,8 @@ class Interface:
ctrl.scroll_to_end() ctrl.scroll_to_end()
def join_gc_minimal(self, account, room_jid, password=None): def join_gc_minimal(self, account, room_jid, password=None,
transient_for=None):
if account is not None: if account is not None:
if app.in_groupchat(account, room_jid): if app.in_groupchat(account, room_jid):
# If we already in the groupchat, join_gc_room will bring # If we already in the groupchat, join_gc_room will bring
@ -1855,7 +1856,8 @@ class Interface:
dialogs.ErrorDialog(_('JID is not a Groupchat'), dialogs.ErrorDialog(_('JID is not a Groupchat'),
transient_for=app.app.get_active_window()) transient_for=app.app.get_active_window())
return return
dialogs.JoinGroupchatWindow(account, room_jid, password=password) dialogs.JoinGroupchatWindow(account, room_jid, password=password,
transient_for=transient_for)
disco_account = connected_accounts[0] if account is None else account disco_account = connected_accounts[0] if account is None else account
app.connections[disco_account].discoverMUC( app.connections[disco_account].discoverMUC(