From 888c4a2446e4927450e328d96ac387a45a4f1977 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Mon, 9 Sep 2013 17:36:21 +0200
Subject: [PATCH] fix E2E / GPG information dialog and another information
 dialog transient_for property. Fixes #7185

---
 src/chat_control.py   | 4 ++--
 src/dialogs.py        | 5 +++--
 src/message_window.py | 3 ++-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/chat_control.py b/src/chat_control.py
index d9690cecf5..25cce3eac5 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -2309,9 +2309,9 @@ class ChatControl(ChatControlBase):
 
     def _on_authentication_button_clicked(self, widget):
         if self.gpg_is_active:
-            dialogs.GPGInfoWindow(self)
+            dialogs.GPGInfoWindow(self, self.parent_win.window)
         elif self.session and self.session.enable_encryption:
-            dialogs.ESessionInfoWindow(self.session)
+            dialogs.ESessionInfoWindow(self.session, self.parent_win.window)
 
     def send_message(self, message, keyID='', chatstate=None, xhtml=None,
     process_commands=True, attention=False):
diff --git a/src/dialogs.py b/src/dialogs.py
index 0aab9be667..da52b0feec 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -5097,7 +5097,7 @@ class ESessionInfoWindow:
     """
     Class for displaying information about a XEP-0116 encrypted session
     """
-    def __init__(self, session):
+    def __init__(self, session, transient_for=None):
         self.session = session
 
         self.xml = gtkgui_helpers.get_gtk_builder('esession_info_window.ui')
@@ -5108,7 +5108,7 @@ class ESessionInfoWindow:
         self.button_label = self.xml.get_object('button_label')
         self.window = self.xml.get_object('esession_info_window')
         self.update_info()
-
+        self.window.set_transient_for(transient_for)
 
         self.window.show_all()
 
@@ -5219,6 +5219,7 @@ class GPGInfoWindow:
         path = gtkgui_helpers.get_icon_path(image, 32)
         security_image.set_from_file(path)
 
+        self.window.set_transient_for(transient_for)
         xml.connect_signals(self)
         self.window.show_all()
 
diff --git a/src/message_window.py b/src/message_window.py
index ad2a2b50b5..17ba02ff78 100644
--- a/src/message_window.py
+++ b/src/message_window.py
@@ -219,7 +219,8 @@ class MessageWindow(object):
             dialogs.YesNoDialog(
                 _('You are going to close several tabs'),
                 _('Do you really want to close them all?'),
-                checktext=_('_Do not ask me again'), on_response_yes=on_yes1)
+                checktext=_('_Do not ask me again'), on_response_yes=on_yes1,
+                transient_for=self.window)
             return True
 
         def on_yes(ctrl):
-- 
GitLab