changeset a10e0df42f31 in /home/hg/repos/gajim

author: lovetox <forenjun...@chelo.at>
branches: 
details:http://hg.gajim.org/gajim?cmd=changeset;node=a10e0df42f31
description: Add transients for some MUC dialogs

diffstat:

 src/dialogs.py           |  30 ++++++++++++++++++------------
 src/groupchat_control.py |   4 ++--
 src/gui_interface.py     |   9 ++++++---
 3 files changed, 26 insertions(+), 17 deletions(-)

diffs (138 lines):

diff -r 9db52e975b8a -r a10e0df42f31 src/dialogs.py
--- a/src/dialogs.py    Sun Sep 18 15:46:39 2016 +0200
+++ b/src/dialogs.py    Wed Sep 21 20:07:37 2016 +0200
@@ -2008,7 +2008,7 @@
     """
 
     def __init__(self, title, label_str, is_modal, ok_handler, cancel_handler,
-    transient_for=None):
+                 transient_for=None):
         self.dialog = self.xml.get_object('input_dialog')
         label = self.xml.get_object('label')
         self.dialog.set_title(title)
@@ -2053,10 +2053,11 @@
     """
 
     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')
-        CommonInputDialog.__init__(self, title, label_str, is_modal, 
ok_handler,
-            cancel_handler, transient_for=transient_for)
+        CommonInputDialog.__init__(self, title, label_str, is_modal,
+                                   ok_handler, cancel_handler,
+                                   transient_for=transient_for)
         self.input_entry = self.xml.get_object('input_entry')
         if input_str:
             self.set_entry(input_str)
@@ -2080,11 +2081,13 @@
     """
 
     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')
         InputDialog.__init__(self, title, label_str, input_str=input_str,
-                is_modal=is_modal, ok_handler=ok_handler,
-                cancel_handler=cancel_handler)
+                             is_modal=is_modal, ok_handler=ok_handler,
+                             cancel_handler=cancel_handler,
+                             transient_for=transient_for)
         self.input_entry = self.xml.get_object('input_entry')
         if input_str:
             self.input_entry.set_text(input_str)
@@ -2125,13 +2128,15 @@
     """
 
     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
         and we are changing our nick
         """
         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.check_next()
 
@@ -2216,10 +2221,11 @@
     """
 
     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')
-        CommonInputDialog.__init__(self, title, label_str, is_modal, 
ok_handler,
-                                                           cancel_handler)
+        CommonInputDialog.__init__(self, title, label_str, is_modal,
+                                   ok_handler, cancel_handler,
+                                   transient_for=transient_for)
         self.input_buffer = self.xml.get_object('input_textview').get_buffer()
         if input_str:
             self.input_buffer.set_text(input_str)
diff -r 9db52e975b8a -r a10e0df42f31 src/groupchat_control.py
--- a/src/groupchat_control.py  Sun Sep 18 15:46:39 2016 +0200
+++ b/src/groupchat_control.py  Wed Sep 21 20:07:37 2016 +0200
@@ -2225,7 +2225,7 @@
 
         dialogs.InputTextDialog(_('Changing 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):
         self.force_non_minimizable = True
@@ -2240,7 +2240,7 @@
             prompt = _('Please specify the new nickname you want to use:')
             gajim.interface.instances['change_nick_dialog'] = \
                 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):
         c = gajim.contacts.get_gc_contact(self.account, self.room_jid,
diff -r 9db52e975b8a -r a10e0df42f31 src/gui_interface.py
--- a/src/gui_interface.py      Sun Sep 18 15:46:39 2016 +0200
+++ b/src/gui_interface.py      Wed Sep 21 20:07:37 2016 +0200
@@ -133,7 +133,7 @@
 
             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')
         prompt = _('Your desired nickname in group chat %s is in use or '
             'registered by another occupant.\nPlease specify another nickname '
@@ -144,7 +144,7 @@
                 prompt)
         else:
             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):
         #('HTTP_AUTH', account, (method, url, transaction_id, iq_obj, msg))
@@ -294,6 +294,9 @@
 
     def handle_event_gc_presence(self, obj):
         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.errcode == '503':
                 # maximum user number reached
@@ -328,7 +331,7 @@
                     _('You are not in the members list in groupchat %s.') % \
                     obj.room_jid)
             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:
                 gc_control.print_conversation('Error %s: %s' % (obj.errcode,
                     obj.errmsg))
_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to