changeset aa4412950028 in /home/hg/repos/gajim

branches: gtk3
details:http://hg.gajim.org/gajim?cmd=changeset;node=aa4412950028
description: make error diaogs in accounts window transient for ccounts window. 
See #7185

diffstat:

 src/config.py  |  43 ++++++++++++++++++++++++++-----------------
 src/dialogs.py |   6 ++++--
 2 files changed, 30 insertions(+), 19 deletions(-)

diffs (166 lines):

diff -r ac9c8fffc491 -r aa4412950028 src/config.py
--- a/src/config.py     Thu Aug 15 14:57:39 2013 +0200
+++ b/src/config.py     Thu Aug 15 15:11:51 2013 +0200
@@ -2011,7 +2011,8 @@
         account = self.current_account
         if len(gajim.events.get_events(account)):
             dialogs.ErrorDialog(_('Unread events'),
-                _('Read all pending events before removing this account.'))
+                _('Read all pending events before removing this account.'),
+                transient_for=self.window)
             return
 
         if gajim.config.get_per('accounts', account, 'is_zeroconf'):
@@ -2054,27 +2055,30 @@
         if active and gajim.connections[self.current_account].connected != 0:
             dialogs.ErrorDialog(
                 _('You are currently connected to the server'),
-                _('To change the account name, you must be disconnected.'))
+                _('To change the account name, you must be disconnected.'),
+                transient_for=self.window)
             return
         if len(gajim.events.get_events(self.current_account)):
             dialogs.ErrorDialog(_('Unread events'),
                 _('To change the account name, you must read all pending '
-                'events.'))
+                'events.'), transient_for=self.window)
             return
         # Get the new name
         def on_renamed(new_name, old_name):
             if new_name in gajim.connections:
                 dialogs.ErrorDialog(_('Account Name Already Used'),
                     _('This name is already used by another of your accounts. '
-                    'Please choose another name.'))
+                    'Please choose another name.'), transient_for=self.window)
                 return
             if (new_name == ''):
                 dialogs.ErrorDialog(_('Invalid account name'),
-                    _('Account name cannot be empty.'))
+                    _('Account name cannot be empty.'),
+                    transient_for=self.window)
                 return
             if new_name.find(' ') != -1:
                 dialogs.ErrorDialog(_('Invalid account name'),
-                    _('Account name cannot contain spaces.'))
+                    _('Account name cannot contain spaces.'),
+                    transient_for=self.window)
                 return
             if active:
                 # update variables
@@ -2174,7 +2178,7 @@
         except helpers.InvalidFormat as s:
             if not widget.is_focus():
                 pritext = _('Invalid Jabber ID')
-                dialogs.ErrorDialog(pritext, str(s))
+                dialogs.ErrorDialog(pritext, str(s), transient_for=self.window)
                 GLib.idle_add(lambda: widget.grab_focus())
             return True
 
@@ -2185,7 +2189,7 @@
                 pritext = _('Invalid Jabber ID')
                 sectext = \
                     _('A Jabber ID must be in the form "user@servername".')
-                dialogs.ErrorDialog(pritext, sectext)
+                dialogs.ErrorDialog(pritext, sectext, 
transient_for=self.window)
                 GLib.idle_add(lambda: widget.grab_focus())
             return True
 
@@ -2251,7 +2255,7 @@
         except helpers.InvalidFormat as s:
             if not widget.is_focus():
                 pritext = _('Invalid Jabber ID')
-                dialogs.ErrorDialog(pritext, str(s))
+                dialogs.ErrorDialog(pritext, str(s), transient_for=self.window)
                 GLib.idle_add(lambda: widget.grab_focus())
             return True
 
@@ -2409,7 +2413,8 @@
         except Exception:
             if not widget.is_focus():
                 dialogs.ErrorDialog(_('Invalid entry'),
-                    _('Custom port must be a port number.'))
+                    _('Custom port must be a port number.'),
+                    transient_for=self.window)
                 GLib.idle_add(lambda: widget.grab_focus())
             return True
         if self.option_changed('custom_port', custom_port):
@@ -2431,7 +2436,8 @@
                 secret_keys = []
         if not secret_keys:
             dialogs.ErrorDialog(_('Failed to get secret keys'),
-                _('There is no OpenPGP secret key available.'))
+                _('There is no OpenPGP secret key available.'),
+                transient_for=self.window)
         secret_keys[_('None')] = _('None')
 
         def on_key_selected(keyID):
@@ -2446,7 +2452,7 @@
             gpg_name_label = self.xml.get_object('gpg_name_label' + \
                 wiget_name_ext)
             use_gpg_agent_checkbutton = self.xml.get_object(
-                    'use_gpg_agent_checkbutton' + wiget_name_ext)
+                'use_gpg_agent_checkbutton' + wiget_name_ext)
             if keyID[0] == _('None'):
                 gpg_key_label.set_text(_('No key selected'))
                 gpg_name_label.set_text('')
@@ -2479,7 +2485,7 @@
         if self.current_account not in gajim.interface.instances:
             dlg = dialogs.ErrorDialog(_('No such account available'),
                 _('You must create your account before editing your personal '
-                'information.'))
+                'information.'), transient_for=self.window)
             return
 
         # show error dialog if account is newly created (not in 
gajim.connections)
@@ -2487,12 +2493,13 @@
         gajim.connections[self.current_account].connected < 2:
             dialogs.ErrorDialog(_('You are not connected to the server'),
                 _('Without a connection, you can not edit your personal '
-                'information.'))
+                'information.'), transient_for=self.window)
             return
 
         if not gajim.connections[self.current_account].vcard_supported:
             dialogs.ErrorDialog(_("Your server doesn't support vCard"),
-                _("Your server can't save your personal information."))
+                _("Your server can't save your personal information."),
+                transient_for=self.window)
             return
 
         jid = gajim.get_jid_from_account(self.current_account)
@@ -2608,7 +2615,8 @@
             self.ignore_events = False
             dialogs.ErrorDialog(
                 _('You are currently connected to the server'),
-                _('To disable the account, you must be disconnected.'))
+                _('To disable the account, you must be disconnected.'),
+                transient_for=self.window)
             return
         if gajim.ZEROCONF_ACC_NAME in gajim.connections and not \
         gajim.connections[gajim.ZEROCONF_ACC_NAME].is_zeroconf:
@@ -2645,7 +2653,8 @@
             self.ignore_events = False
             dialogs.ErrorDialog(
                 _('You are currently connected to the server'),
-                _('To disable the account, you must be disconnected.'))
+                _('To disable the account, you must be disconnected.'),
+                transient_for=self.window)
             return
         # add/remove account in roster and all variables
         if widget.get_active():
diff -r ac9c8fffc491 -r aa4412950028 src/dialogs.py
--- a/src/dialogs.py    Thu Aug 15 14:57:39 2013 +0200
+++ b/src/dialogs.py    Thu Aug 15 15:11:51 2013 +0200
@@ -1628,8 +1628,10 @@
     """
 
     def __init__(self, pritext, sectext='', on_response_ok=None,
-    on_response_cancel=None):
-        if hasattr(gajim.interface, 'roster') and gajim.interface.roster:
+    on_response_cancel=None, 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
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to