changeset 93bff5d6bd5f in /home/hg/repos/gajim

branches: gajim_0.16
details:http://hg.gajim.org/gajim?cmd=changeset;node=93bff5d6bd5f
description: fix transient for windows. Fixes #7185

diffstat:

 src/chat_control.py      |  12 +++++++-----
 src/dialogs.py           |  33 ++++++++++++++++++++++-----------
 src/disco.py             |   8 +++++---
 src/groupchat_control.py |  12 ++++++++----
 src/session.py           |   3 ++-
 5 files changed, 44 insertions(+), 24 deletions(-)

diffs (205 lines):

diff -r 296b7ab8b24f -r 93bff5d6bd5f src/chat_control.py
--- a/src/chat_control.py       Thu Aug 15 22:20:13 2013 +0200
+++ b/src/chat_control.py       Thu Aug 15 23:14:42 2013 +0200
@@ -2787,11 +2787,13 @@
                 on_no(self)
 
             dialogs.ConfirmationDialog(
-                    # %s is being replaced in the code with JID
-                    _('You just received a new message from "%s"') % 
self.contact.jid,
-                    _('If you close this tab and you have history disabled, '\
-                    'this message will be lost.'), on_response_ok=on_ok,
-                    on_response_cancel=on_cancel)
+                #%s is being replaced in the code with JID
+                _('You just received a new message from "%s"') % \
+                self.contact.jid,
+                _('If you close this tab and you have history disabled, '\
+                'this message will be lost.'), on_response_ok=on_ok,
+                on_response_cancel=on_cancel,
+                transient_for=self.parent_win.window)
             return
         on_yes(self)
 
diff -r 296b7ab8b24f -r 93bff5d6bd5f src/dialogs.py
--- a/src/dialogs.py    Thu Aug 15 22:20:13 2013 +0200
+++ b/src/dialogs.py    Thu Aug 15 23:14:42 2013 +0200
@@ -1508,10 +1508,10 @@
     """
 
     def __init__(self, pritext, sectext='', on_response_ok=None,
-                             on_response_cancel=None):
+    on_response_cancel=None, transient_for=None):
         self.user_response_ok = on_response_ok
         self.user_response_cancel = on_response_cancel
-        HigDialog.__init__(self, None,
+        HigDialog.__init__(self, transient_for,
            gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK_CANCEL, pritext, sectext,
            self.on_response_ok, self.on_response_cancel)
         self.popup()
@@ -1589,8 +1589,10 @@
     HIG compliant info dialog
     """
 
-    def __init__(self, pritext, sectext=''):
-        if hasattr(gajim.interface, 'roster') and gajim.interface.roster:
+    def __init__(self, pritext, sectext='', transient_for=None):
+        if transient_for:
+            parent = transient_for
+        elif hasattr(gajim.interface, 'roster') and gajim.interface.roster:
             parent = gajim.interface.roster.window
         else:
             parent = None
@@ -1712,11 +1714,13 @@
     """
 
     def __init__(self, pritext, sectext='', checktext='', on_response_ok=None,
-                    on_response_cancel=None, is_modal=True):
+    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(gajim.interface, 'roster') and gajim.interface.roster:
+        if transient_for:
+            parent = transient_for
+        elif hasattr(gajim.interface, 'roster') and gajim.interface.roster:
             parent = gajim.interface.roster.window
         else:
             parent = None
@@ -1972,13 +1976,16 @@
     Common Class for Input dialogs
     """
 
-    def __init__(self, title, label_str, is_modal, ok_handler, cancel_handler):
+    def __init__(self, title, label_str, is_modal, ok_handler, cancel_handler,
+    transient_for=None):
         self.dialog = self.xml.get_object('input_dialog')
         label = self.xml.get_object('label')
         self.dialog.set_title(title)
         label.set_markup(label_str)
         self.cancel_handler = cancel_handler
         self.vbox = self.xml.get_object('vbox')
+        if transient_for:
+            self.dialog.set_transient_for(transient_for)
 
         self.ok_handler = ok_handler
         okbutton = self.xml.get_object('okbutton')
@@ -2015,10 +2022,10 @@
     """
 
     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_dialog.ui')
         CommonInputDialog.__init__(self, title, label_str, is_modal, 
ok_handler,
-            cancel_handler)
+            cancel_handler, transient_for=transient_for)
         self.input_entry = self.xml.get_object('input_entry')
         if input_str:
             self.set_entry(input_str)
@@ -2198,7 +2205,8 @@
     """
 
     def __init__(self, title, label_str1, label_str2, input_str1=None,
-            input_str2=None, is_modal=True, ok_handler=None, 
cancel_handler=None):
+    input_str2=None, is_modal=True, ok_handler=None, cancel_handler=None,
+    transient_for=None):
         self.xml = gtkgui_helpers.get_gtk_builder('dubbleinput_dialog.ui')
         self.dialog = self.xml.get_object('dubbleinput_dialog')
         label1 = self.xml.get_object('label1')
@@ -2215,6 +2223,8 @@
         if input_str2:
             self.input_entry2.set_text(input_str2)
             self.input_entry2.select_region(0, -1) # select all
+        if transient_for:
+            self.dialog.set_transient_for(transient_for)
 
         self.dialog.set_modal(is_modal)
 
@@ -4531,7 +4541,8 @@
         name = self.new_privacy_list_entry.get_text()
         if not name:
             ErrorDialog(_('Invalid List Name'),
-                _('You must enter a name to create a privacy list.'))
+                _('You must enter a name to create a privacy list.'),
+                transient_for=self.window)
             return
         key_name = 'privacy_list_%s' % name
         if key_name in gajim.interface.instances[self.account]:
diff -r 296b7ab8b24f -r 93bff5d6bd5f src/disco.py
--- a/src/disco.py      Thu Aug 15 22:20:13 2013 +0200
+++ b/src/disco.py      Thu Aug 15 23:14:42 2013 +0200
@@ -759,13 +759,15 @@
                 # We can't travel anywhere else.
                 self.destroy()
             dialogs.ErrorDialog(_('The service could not be found'),
-_('There is no service at the address you entered, or it is not responding. '
-    'Check the address and try again.'))
+                _('There is no service at the address you entered, or it is '
+                'not responding. Check the address and try again.'),
+                transient_for=self.window)
             return
         klass = self.cache.get_browser(identities, features)
         if not klass:
             dialogs.ErrorDialog(_('The service is not browsable'),
-_('This type of service does not contain any items to browse.'))
+                _('This type of service does not contain any items to 
browse.'),
+                transient_for=self.window)
             return
         elif klass is None:
             klass = AgentBrowser
diff -r 296b7ab8b24f -r 93bff5d6bd5f src/groupchat_control.py
--- a/src/groupchat_control.py  Thu Aug 15 22:20:13 2013 +0200
+++ b/src/groupchat_control.py  Thu Aug 15 23:14:42 2013 +0200
@@ -2130,7 +2130,8 @@
 
             dialogs.ConfirmationDialogCheck(pritext, sectext,
                 _('_Do not ask me again'), on_response_ok=on_ok,
-                on_response_cancel=on_cancel)
+                on_response_cancel=on_cancel,
+                transient_for=self.parent_win.window)
             return
 
         on_yes(self)
@@ -2206,7 +2207,8 @@
         dialogs.DoubleInputDialog(_('Destroying %s') % u'\u200E' + \
             self.room_jid, _('You are going to definitively destroy this '
             'room.\nYou may specify a reason below:'),
-            _('You may also enter an alternate venue:'), ok_handler=on_ok)
+            _('You may also enter an alternate venue:'), ok_handler=on_ok,
+            transient_for=self.parent_win.window)
 
     def _on_bookmark_room_menuitem_activate(self, widget):
         """
@@ -2406,7 +2408,8 @@
 
         # ask for reason
         dialogs.InputDialog(_('Kicking %s') % nick,
-            _('You may specify a reason below:'), ok_handler=on_ok)
+            _('You may specify a reason below:'), ok_handler=on_ok,
+            transient_for=self.parent_win.window)
 
     def mk_menu(self, event, iter_):
         """
@@ -2738,7 +2741,8 @@
         nick = gajim.get_nick_from_jid(jid)
         # ask for reason
         dialogs.InputDialog(_('Banning %s') % nick,
-            _('You may specify a reason below:'), ok_handler=on_ok)
+            _('You may specify a reason below:'), ok_handler=on_ok,
+            transient_for=self.parent_win.window)
 
     def grant_membership(self, widget, jid):
         """
diff -r 296b7ab8b24f -r 93bff5d6bd5f src/session.py
--- a/src/session.py    Thu Aug 15 22:20:13 2013 +0200
+++ b/src/session.py    Thu Aug 15 23:14:42 2013 +0200
@@ -413,7 +413,8 @@
                             'acceptable?''') % (
                             negotiation.describe_features(ask_user)),
                             on_response_yes=accept_nondefault_options,
-                            on_response_no=reject_nondefault_options)
+                            on_response_no=reject_nondefault_options,
+                            transient_for=self.control.parent_win.window)
                     else:
                         self.respond_e2e_bob(form, negotiated, not_acceptable)
 
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to