Currently question/error/info dialogs have no option to set the parent window. This causes issues like given in LP252208. This patch adds a parent argument to all dialogs and implements that argument in the dialog calls in gcommit.
Also some cleanup of the imports in both files.
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: [EMAIL PROTECTED]
# target_branch: https://code.launchpad.net/~bzr-gtk/bzr-gtk/trunk
# testament_sha1: 32091188a29d7566bfbad205d9561b7268637f19
# timestamp: 2008-07-27 09:59:27 +0200
# source_branch: https://code.launchpad.net/~bzr-gtk/bzr-gtk/trunk
# base_revision_id: [EMAIL PROTECTED]
# 
# Begin patch
=== modified file 'commit.py'
--- commit.py	2008-06-07 09:00:24 +0000
+++ commit.py	2008-07-27 07:59:23 +0000
@@ -14,6 +14,9 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+import os.path
+import re
+
 try:
     import pygtk
     pygtk.require("2.0")
@@ -24,16 +27,13 @@
 import gobject
 import pango
 
-import os.path
-import re
-
 from bzrlib import errors, osutils
 from bzrlib.trace import mutter
 from bzrlib.util import bencode
 
 from bzrlib.plugins.gtk import _i18n
-from dialog import error_dialog, question_dialog
-from errors import show_bzr_error
+from bzrlib.plugins.gtk.dialog import question_dialog
+from bzrlib.plugins.gtk.errors import show_bzr_error
 
 try:
     import dbus
@@ -105,7 +105,6 @@
                                   parent=parent,
                                   flags=0,
                                   buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
-        self._question_dialog = question_dialog
 
         self._wt = wt
         # TODO: Do something with this value, it is used by Olive
@@ -651,9 +650,10 @@
         message = self._get_global_commit_message()
 
         if message == '':
-            response = self._question_dialog(
+            response = question_dialog(
                 _i18n('Commit with an empty message?'),
-                _i18n('You can describe your commit intent in the message.'))
+                _i18n('You can describe your commit intent in the message.'),
+                parent=self)
             if response == gtk.RESPONSE_NO:
                 # Kindly give focus to message area
                 self._global_message_text_view.grab_focus()
@@ -671,9 +671,11 @@
         #       entirely, since there isn't a way for them to add the unknown
         #       files at this point.
         for path in self._wt.unknowns():
-            response = self._question_dialog(
+            response = question_dialog(
                 _i18n("Commit with unknowns?"),
-                _i18n("Unknown files exist in the working tree. Commit anyway?"))
+                _i18n("Unknown files exist in the working tree. Commit anyway?"),
+                parent=self)
+                # Doesn't set a parent for the dialog..
             if response == gtk.RESPONSE_NO:
                 return
             break
@@ -690,10 +692,11 @@
                        specific_files=specific_files,
                        revprops=revprops)
         except errors.PointlessCommit:
-            response = self._question_dialog(
+            response = question_dialog(
                 _i18n('Commit with no changes?'),
                 _i18n('There are no changes in the working tree.'
-                      ' Do you want to commit anyway?'))
+                      ' Do you want to commit anyway?'),
+                parent=self)
             if response == gtk.RESPONSE_YES:
                 rev_id = self._wt.commit(message,
                                allow_pointless=True,

=== modified file 'dialog.py'
--- dialog.py	2008-04-11 20:34:06 +0000
+++ dialog.py	2008-07-27 07:59:23 +0000
@@ -21,17 +21,16 @@
     pass
 
 import gtk
-import gtk.glade
-
-
-def _message_dialog(type, primary, secondary, buttons=gtk.BUTTONS_OK):
+
+
+def _message_dialog(type, primary, secondary, parent=None, buttons=gtk.BUTTONS_OK):
     """ Display a given type of MessageDialog with the given message.
     
     :param type: message dialog type
     
     :param message: the message you want to display.
     """
-    dialog = gtk.MessageDialog(flags=gtk.DIALOG_MODAL, type=type,
+    dialog = gtk.MessageDialog(flags=gtk.DIALOG_MODAL, type=type, parent=parent,
                                buttons=buttons)
     dialog.set_markup('<big><b>' + primary + '</b></big>')
     dialog.format_secondary_markup(secondary)
@@ -39,18 +38,18 @@
     dialog.destroy()
     return response
 
-def error_dialog(primary, secondary):
+def error_dialog(primary, secondary, parent=None):
     """ Display an error dialog with the given message. """
-    return _message_dialog(gtk.MESSAGE_ERROR, primary, secondary)
+    return _message_dialog(gtk.MESSAGE_ERROR, primary, secondary, parent)
 
-def info_dialog(primary, secondary):
+def info_dialog(primary, secondary, parent=None):
     """ Display an info dialog with the given message. """
-    return _message_dialog(gtk.MESSAGE_INFO, primary, secondary)
+    return _message_dialog(gtk.MESSAGE_INFO, primary, secondary, parent)
 
-def warning_dialog(primary, secondary):
+def warning_dialog(primary, secondary, parent=None):
     """ Display a warning dialog with the given message. """
-    return _message_dialog(gtk.MESSAGE_WARNING, primary, secondary)
+    return _message_dialog(gtk.MESSAGE_WARNING, primary, secondary, parent)
 
-def question_dialog(primary, secondary):
+def question_dialog(primary, secondary, parent=None):
     """ Display a dialog with the given question. """
-    return _message_dialog(gtk.MESSAGE_QUESTION, primary, secondary, gtk.BUTTONS_YES_NO)
+    return _message_dialog(gtk.MESSAGE_QUESTION, primary, secondary, parent, gtk.BUTTONS_YES_NO)

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWTqT8m8AAx3/gEBUEABZ5///
/7/+oL////BgBpwqL4VQW1ChQKB0EkkyRoUeGp6p6ejR6qeRpqeSemo0A0yNPRDynlD1A0qDQ/VN
BppiNAMhoAAADQaAGhjjJk0YhpoYCaGJo0yYgZGE0aaYQZMJTRBTyKnppgoeUep6gAAABoaA0AA4
yZNGIaaGAmhiaNMmIGRhNGmmEGTCSQhkaBAEaaNU9pMU8Im1PU8k09TTamg0GnpJgcWnVl1v0Lc7
PH2UVSSWh1qT8lzZjg+wCkoxZYNNkFFserxDSRCZmHB91OPnzDDdGNLSoEUnFH98otqBhrMzcmTa
3GZRCSTMEvizNO+N1GV+Z+Lzp1CEjgLtci6KSatpURXI9eF6Kamiampq1Ih07Dmss5zXsKpy5MV4
PGfexVuOEa9ctSTTSD6LG7Dxh5NW6ey9mxVsbjkZfrXBmaWDWeoPJghoCuI5GJPNXHM2DBb6sWCD
yh6w43VeqhBJCml+dkjp39GrLZrVYEwyJWR31LAp+Yx91QS+lOdSgd4WO37Pgg79JoJAaa4r4GRC
uqOuam0V60YgWGIno0PQaU/9FywmOt+NSRotmY8/oG05+w92YKJgkKVey4/ghgJguqbSlnmEbWMp
BI6wIRKULghoJKm4+6o8TuWKRJhKNTiD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jAsAq0NUiCS5yx6OqfwoQc1BUFQRYSeyZ
kpOTyfDrOd09rP4BI3AciDvoB31ZKYkyDzRTZuVQE2ejKtb0+CIK/ybbprzSxrPZGtku5RzZuYL0
ytKXHbE+A9ODDbMOwGnNMYZysXccC6Io0l+Fu5711sh3D3IHIZ8e8C/qkkj6rxDN7Ymdk/2lqnvs
1oIYDLIF1/x3jiMRZ11E1WhhmCQDmEDGl9Dt5B3cgjXRCp4zQORB4KFKzIOZb3HrcsE/jQOOQCYS
txcCpYURPc8sVrsV5wcwqIJvEl2wkUoMoVs6d4VUuWaY4oiisRogQgiSzPg/EZRYLb9X2weFALWD
khFXRlIKBoS1X6hmBAzEwWI0yNMgFpCKQsgC8IUGGJnAs1dYFXAgZFGUw3DxAwM8wHQJxmUrE8lG
af2zQaF/4u5IpwoSB1J+TeA=

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
bzr-gtk mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.canonical.com/mailman/listinfo/bzr-gtk

Reply via email to