Add transients for some MUC dialogs
This commit is contained in:
parent
b51b633d2a
commit
de9a1ce069
3 changed files with 26 additions and 17 deletions
|
@ -2055,8 +2055,9 @@ class InputDialog(CommonInputDialog):
|
||||||
def __init__(self, title, label_str, input_str=None, is_modal=True,
|
def __init__(self, title, label_str, input_str=None, is_modal=True,
|
||||||
ok_handler=None, cancel_handler=None, transient_for=None):
|
ok_handler=None, cancel_handler=None, transient_for=None):
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('input_dialog.ui')
|
self.xml = gtkgui_helpers.get_gtk_builder('input_dialog.ui')
|
||||||
CommonInputDialog.__init__(self, title, label_str, is_modal, ok_handler,
|
CommonInputDialog.__init__(self, title, label_str, is_modal,
|
||||||
cancel_handler, transient_for=transient_for)
|
ok_handler, cancel_handler,
|
||||||
|
transient_for=transient_for)
|
||||||
self.input_entry = self.xml.get_object('input_entry')
|
self.input_entry = self.xml.get_object('input_entry')
|
||||||
if input_str:
|
if input_str:
|
||||||
self.set_entry(input_str)
|
self.set_entry(input_str)
|
||||||
|
@ -2080,11 +2081,13 @@ class InputDialogCheck(InputDialog):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, title, label_str, checktext='', input_str=None,
|
def __init__(self, title, label_str, checktext='', input_str=None,
|
||||||
is_modal=True, ok_handler=None, cancel_handler=None):
|
is_modal=True, ok_handler=None, cancel_handler=None,
|
||||||
|
transient_for=None):
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('input_dialog.ui')
|
self.xml = gtkgui_helpers.get_gtk_builder('input_dialog.ui')
|
||||||
InputDialog.__init__(self, title, label_str, input_str=input_str,
|
InputDialog.__init__(self, title, label_str, input_str=input_str,
|
||||||
is_modal=is_modal, ok_handler=ok_handler,
|
is_modal=is_modal, ok_handler=ok_handler,
|
||||||
cancel_handler=cancel_handler)
|
cancel_handler=cancel_handler,
|
||||||
|
transient_for=transient_for)
|
||||||
self.input_entry = self.xml.get_object('input_entry')
|
self.input_entry = self.xml.get_object('input_entry')
|
||||||
if input_str:
|
if input_str:
|
||||||
self.input_entry.set_text(input_str)
|
self.input_entry.set_text(input_str)
|
||||||
|
@ -2125,13 +2128,15 @@ class ChangeNickDialog(InputDialogCheck):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, account, room_jid, title, prompt, check_text=None,
|
def __init__(self, account, room_jid, title, prompt, check_text=None,
|
||||||
change_nick=False):
|
change_nick=False, transient_for=None):
|
||||||
"""
|
"""
|
||||||
change_nick must be set to True when we are already occupant of the room
|
change_nick must be set to True when we are already occupant of the room
|
||||||
and we are changing our nick
|
and we are changing our nick
|
||||||
"""
|
"""
|
||||||
InputDialogCheck.__init__(self, title, '', checktext=check_text,
|
InputDialogCheck.__init__(self, title, '', checktext=check_text,
|
||||||
input_str='', is_modal=True, ok_handler=None, cancel_handler=None)
|
input_str='', is_modal=True, ok_handler=None,
|
||||||
|
cancel_handler=None,
|
||||||
|
transient_for=transient_for)
|
||||||
self.room_queue = [(account, room_jid, prompt, change_nick)]
|
self.room_queue = [(account, room_jid, prompt, change_nick)]
|
||||||
self.check_next()
|
self.check_next()
|
||||||
|
|
||||||
|
@ -2216,10 +2221,11 @@ class InputTextDialog(CommonInputDialog):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, title, label_str, input_str=None, is_modal=True,
|
def __init__(self, title, label_str, input_str=None, is_modal=True,
|
||||||
ok_handler=None, cancel_handler=None):
|
ok_handler=None, cancel_handler=None, transient_for=None):
|
||||||
self.xml = gtkgui_helpers.get_gtk_builder('input_text_dialog.ui')
|
self.xml = gtkgui_helpers.get_gtk_builder('input_text_dialog.ui')
|
||||||
CommonInputDialog.__init__(self, title, label_str, is_modal, ok_handler,
|
CommonInputDialog.__init__(self, title, label_str, is_modal,
|
||||||
cancel_handler)
|
ok_handler, cancel_handler,
|
||||||
|
transient_for=transient_for)
|
||||||
self.input_buffer = self.xml.get_object('input_textview').get_buffer()
|
self.input_buffer = self.xml.get_object('input_textview').get_buffer()
|
||||||
if input_str:
|
if input_str:
|
||||||
self.input_buffer.set_text(input_str)
|
self.input_buffer.set_text(input_str)
|
||||||
|
|
|
@ -2225,7 +2225,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
|
|
||||||
dialogs.InputTextDialog(_('Changing Subject'),
|
dialogs.InputTextDialog(_('Changing Subject'),
|
||||||
_('Please specify the new subject:'), input_str=self.subject,
|
_('Please specify the new subject:'), input_str=self.subject,
|
||||||
ok_handler=on_ok)
|
ok_handler=on_ok, transient_for=self.parent_win.window)
|
||||||
|
|
||||||
def _on_disconnect_menuitem_activate(self, widget):
|
def _on_disconnect_menuitem_activate(self, widget):
|
||||||
self.force_non_minimizable = True
|
self.force_non_minimizable = True
|
||||||
|
@ -2240,7 +2240,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
prompt = _('Please specify the new nickname you want to use:')
|
prompt = _('Please specify the new nickname you want to use:')
|
||||||
gajim.interface.instances['change_nick_dialog'] = \
|
gajim.interface.instances['change_nick_dialog'] = \
|
||||||
dialogs.ChangeNickDialog(self.account, self.room_jid, title,
|
dialogs.ChangeNickDialog(self.account, self.room_jid, title,
|
||||||
prompt, change_nick=True)
|
prompt, change_nick=True, transient_for=self.parent_win.window)
|
||||||
|
|
||||||
def _on_configure_room_menuitem_activate(self, widget):
|
def _on_configure_room_menuitem_activate(self, widget):
|
||||||
c = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
c = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
||||||
|
|
|
@ -133,7 +133,7 @@ class Interface:
|
||||||
|
|
||||||
cls(obj.pri_txt, GLib.markup_escape_text(obj.sec_txt))
|
cls(obj.pri_txt, GLib.markup_escape_text(obj.sec_txt))
|
||||||
|
|
||||||
def handle_ask_new_nick(self, account, room_jid):
|
def handle_ask_new_nick(self, account, room_jid, parent_win):
|
||||||
title = _('Unable to join group chat')
|
title = _('Unable to join group chat')
|
||||||
prompt = _('Your desired nickname in group chat %s is in use or '
|
prompt = _('Your desired nickname in group chat %s is in use or '
|
||||||
'registered by another occupant.\nPlease specify another nickname '
|
'registered by another occupant.\nPlease specify another nickname '
|
||||||
|
@ -144,7 +144,7 @@ class Interface:
|
||||||
prompt)
|
prompt)
|
||||||
else:
|
else:
|
||||||
self.instances['change_nick_dialog'] = dialogs.ChangeNickDialog(
|
self.instances['change_nick_dialog'] = dialogs.ChangeNickDialog(
|
||||||
account, room_jid, title, prompt)
|
account, room_jid, title, prompt, transient_for=parent_win)
|
||||||
|
|
||||||
def handle_event_http_auth(self, obj):
|
def handle_event_http_auth(self, obj):
|
||||||
#('HTTP_AUTH', account, (method, url, transaction_id, iq_obj, msg))
|
#('HTTP_AUTH', account, (method, url, transaction_id, iq_obj, msg))
|
||||||
|
@ -294,6 +294,9 @@ class Interface:
|
||||||
|
|
||||||
def handle_event_gc_presence(self, obj):
|
def handle_event_gc_presence(self, obj):
|
||||||
gc_control = obj.gc_control
|
gc_control = obj.gc_control
|
||||||
|
parent_win = None
|
||||||
|
if gc_control.parent_win:
|
||||||
|
parent_win = gc_control.parent_win.window
|
||||||
if obj.ptype == 'error':
|
if obj.ptype == 'error':
|
||||||
if obj.errcode == '503':
|
if obj.errcode == '503':
|
||||||
# maximum user number reached
|
# maximum user number reached
|
||||||
|
@ -328,7 +331,7 @@ class Interface:
|
||||||
_('You are not in the members list in groupchat %s.') % \
|
_('You are not in the members list in groupchat %s.') % \
|
||||||
obj.room_jid)
|
obj.room_jid)
|
||||||
elif (obj.errcode == '409') or (obj.errcon == 'conflict'):
|
elif (obj.errcode == '409') or (obj.errcon == 'conflict'):
|
||||||
self.handle_ask_new_nick(obj.conn.name, obj.room_jid)
|
self.handle_ask_new_nick(obj.conn.name, obj.room_jid, parent_win)
|
||||||
elif gc_control:
|
elif gc_control:
|
||||||
gc_control.print_conversation('Error %s: %s' % (obj.errcode,
|
gc_control.print_conversation('Error %s: %s' % (obj.errcode,
|
||||||
obj.errmsg))
|
obj.errmsg))
|
||||||
|
|
Loading…
Add table
Reference in a new issue