From 78c7ca566f5b30023d5ea48a73fdf536e8f70e73 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Tue, 7 Jun 2005 01:10:24 +0000 Subject: [PATCH] try again later --- src/chat.py | 2 +- src/common/connection.py | 25 +++--- src/config.py | 50 +++++++----- src/dialogs.py | 156 +++++++++++++++++++++++++------------- src/gajim.py | 24 +++--- src/groupchat_window.py | 11 ++- src/roster_window.py | 19 +++-- src/tabbed_chat_window.py | 23 +++--- src/vcard.py | 6 +- 9 files changed, 202 insertions(+), 114 deletions(-) diff --git a/src/chat.py b/src/chat.py index 85a89b2bc..a0c9da9ee 100644 --- a/src/chat.py +++ b/src/chat.py @@ -243,7 +243,7 @@ class Chat: try: gtkspell.Spell(message_textview) except gobject.GError, msg: - dialogs.Error_dialog(str(msg) + '\n\n' + _('If that is not your language for which you want to highlight misspelled words, then please set your $LANG as appropriate. Eg. for French do export LANG=fr_FR or export LANG=fr_FR.UTF-8 in ~/.bash_profile or to make it global in /etc/profile.\n\nHighlighting misspelled words will not be used')) + dialogs.Error_dialog(str(msg), _('If that is not your language for which you want to highlight misspelled words, then please set your $LANG as appropriate. Eg. for French do export LANG=fr_FR or export LANG=fr_FR.UTF-8 in ~/.bash_profile or to make it global in /etc/profile.\n\nHighlighting misspelled words feature will not be used')).get_response() gajim.config.set('use_speller', False) conversation_textview = self.xmls[jid].get_widget( diff --git a/src/common/connection.py b/src/common/connection.py index 9a727de0d..e49cfccd4 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -134,11 +134,14 @@ class Connection: gajim.config.set('usegpg', False) # END __init__ - def dispatch(self, event, data): + def dispatch(self, event, pritext, sectext=''): if not event in self.handlers: return for handler in self.handlers[event]: - handler(self.name, data) + if len(sectext): + handler(self.name, pritext, sectext) + else: + handler(self.name, pritext) # this is in features.py but it is blocking def _discover(self, ns, jid, node = None): @@ -161,7 +164,7 @@ class Connection: self._discover(common.xmpp.NS_DISCO_INFO, jid, node) def _vCardCB(self, con, vc): - """Called when we recieve a vCard + """Called when we receive a vCard Parse the vCard and send it to plugins""" frm = vc.getFrom() if frm: @@ -188,7 +191,7 @@ class Connection: def _messageCB(self, con, msg): - """Called when we recieve a message""" + """Called when we receive a message""" msgtxt = msg.getBody() if not msg.getTag('body'): #no return @@ -230,7 +233,7 @@ class Connection: # END messageCB def _presenceCB(self, con, prs): - """Called when we recieve a presence""" + """Called when we receive a presence""" who = str(prs.getFrom()) prio = prs.getPriority() if not prio: @@ -314,7 +317,7 @@ class Connection: self.dispatch('STATUS', 'offline') self.connection = None if not self.on_purpose: - self.dispatch('ERROR', _('You have been disconnected from %s') % self.name) + self.dispatch('ERROR', _('Connection with account "%s" has been lost') %\ self.name, _('To continue sending and receiving messages, you will need to reconnect.')) self.on_purpose = False # END disconenctedCB @@ -575,7 +578,7 @@ class Connection: gajim.log.debug("Couldn't connect to %s" % self.name) self.connected = 0 self.dispatch('STATUS', 'offline') - self.dispatch('ERROR', _("Couldn't connect to %s") % self.name) + self.dispatch('ERROR', _('Could not connect to "%s"') % self.name) return None con.RegisterHandler('message', self._messageCB) @@ -610,7 +613,7 @@ class Connection: except IOError: #probably a timeout self.connected = 0 self.dispatch('STATUS', 'offline') - self.dispatch('ERROR', _("Couldn't connect to %s") % self.name) + self.dispatch('ERROR', _('Could not connect to "%s"') % self.name) return None if auth: con.initRoster() @@ -620,7 +623,8 @@ class Connection: gajim.log.debug("Couldn't authenticate to %s" % self.name) self.connected = 0 self.dispatch('STATUS', 'offline') - self.dispatch('ERROR', _('Authentication failed with %s, check your login and password') % name) + self.dispatch('ERROR', _('Authentication failed with "%s"' % name), \ + _('Please check your login and password for correctness.')) return None # END connect @@ -840,7 +844,8 @@ class Connection: con_type = c.connect((config['hostname'], port), proxy = proxy) if not con_type: gajim.log.debug("Couldn't connect to %s" % name) - self.dispatch('ERROR', _("Couldn't connect to %s") % name) + self.dispatch('ERROR', _('Could not connect to "%s"') % name, + _('Please try again later')) return False gajim.log.debug('Connected to server') # FIXME! This blocks! diff --git a/src/config.py b/src/config.py index cd7e736f1..dddb23d59 100644 --- a/src/config.py +++ b/src/config.py @@ -1140,10 +1140,10 @@ class Account_modification_window: self.xml.get_widget('gpg_choose_button').set_sensitive(False) self.xml.get_widget('autoconnect_checkbutton').set_active(gajim.config.\ get_per('accounts', self.account, 'autoconnect')) - self.xml.get_widget('sync_with_global_status_checkbutton').set_active( \ + self.xml.get_widget('sync_with_global_status_checkbutton').set_active( gajim.config.get_per('accounts', self.account, \ 'sync_with_global_status')) - list_no_log_for = gajim.config.get_per('accounts', self.account, \ + list_no_log_for = gajim.config.get_per('accounts', self.account, 'no_log_for').split() if self.account in list_no_log_for: self.xml.get_widget('log_history_checkbutton').set_active(0) @@ -1155,24 +1155,29 @@ class Account_modification_window: if gajim.connections.has_key(self.account): if name != self.account and \ gajim.connections[self.account].connected != 0: - dialogs.Error_dialog(_('You must be offline to change the account\'s name')) + dialogs.Error_dialog(_('You are connected to the server'), +_('To change the account name, it must be disconnected.')).get_response() return if (name == ''): - dialogs.Error_dialog(_('You must enter a name for this account')) + dialogs.Error_dialog(_('Invalid account name'), + _('Account names cannot be empty.')).get_response() return if name.find(' ') != -1: - dialogs.Error_dialog(_('Spaces are not permited in account name')) + dialogs.Error_dialog(_('Invalid account name'), + _('Account names cannot contain spaces.')).get_response() return jid = self.xml.get_widget('jid_entry').get_text() if jid == '' or jid.count('@') != 1: - dialogs.Error_dialog(_('You must enter a Jabber ID for this account\nFor example: someone@someserver.org')) + dialogs.Error_dialog(_('Invalid Jabber ID'), + _('A Jabber ID must be in the form "user@servername".')).get_response() return new_account = self.xml.get_widget('new_account_checkbutton').get_active() config['savepass'] = self.xml.get_widget( 'save_password_checkbutton').get_active() config['password'] = self.xml.get_widget('password_entry').get_text() if new_account and config['password'] == '': - dialogs.Error_dialog(_('You must enter a password to register a new account')) + dialogs.Error_dialog(_('Invalid password'), + _('You must enter a password for the new account.')).get_response() return config['resource'] = self.xml.get_widget('resource_entry').get_text() config['priority'] = self.xml.get_widget('priority_spinbutton').\ @@ -1203,15 +1208,18 @@ class Account_modification_window: if config['use_proxy']: if config['proxyport'] != '': if not config['proxyport'].isdigit(): - dialogs.Error_dialog(_('Proxy port must be a port number')) + dialogs.Error_dialog(_('Invalid proxy port'), + _('Port numbers must contain digits only.')).get_response() return config['proxyport'] = int(config['proxyport']) else: - dialogs.Error_dialog(_('You must enter a proxy port to use proxy')) + dialogs.Error_dialog(_('Invalid proxy port'), + _('You must enter a port number to use a proxy.')).get_response() return if config['proxyhost'] == '': - dialogs.Error_dialog(_('You must enter a proxy host to use proxy')) + dialogs.Error_dialog(_('Invalid proxy host'), + _('You must enter a proxy host to use a proxy.')).get_response() return config['usessl'] = self.xml.get_widget('use_ssl_checkbutton').get_active() @@ -1283,7 +1291,8 @@ class Account_modification_window: return #if it's a new account if name in gajim.connections: - dialogs.Error_dialog(_('This name is taken by an another account of yours')) + dialogs.Error_dialog(_('Account name is in use'), + _('You already have an account using this name.')).get_response() return con = connection.Connection(name) self.plugin.register_handlers(con) @@ -1335,11 +1344,13 @@ class Account_modification_window: def on_edit_details_button_clicked(self, widget): if not self.plugin.windows.has_key(self.account): - dialogs.Error_dialog(_('You must first create your account before editing your personal information')) + dialogs.Error_dialog(_('No such account available'), + _('You must create your account before editing your personal information.')).get_response() return jid = self.xml.get_widget('jid_entry').get_text() if gajim.connections[self.account].connected < 2: - dialogs.Error_dialog(_('You must be connected to edit your personal information')) + dialogs.Error_dialog(_('You are not connected to the server'), + _('Without a connection, you can not edit your personal information.')).get_response() return if not self.plugin.windows[self.account]['infos'].has_key('vcard'): self.plugin.windows[self.account]['infos'][jid] = \ @@ -1349,7 +1360,8 @@ class Account_modification_window: def on_gpg_choose_button_clicked(self, widget, data = None): secret_keys = gajim.connections[self.account].ask_gpg_secrete_keys() if not secret_keys: - dialogs.Error_dialog(_('Error while getting secret keys')) + dialogs.Error_dialog(_('Failed to get secret keys'), +_('There was a problem retrieving your GPG secret keys.')).get_response() return secret_keys['None'] = 'None' w = dialogs.choose_gpg_key_dialog(secret_keys) @@ -1727,7 +1739,8 @@ class Service_discovery_window: self.account = account self.agent_infos = {} if gajim.connections[account].connected < 2: - dialogs.Error_dialog(_('You must be connected to browse services')) + dialogs.Error_dialog(_('You are not connected to the server'), +_('Without a connection, you can not browse available services')).get_response() raise RuntimeError, 'You must be connected to browse services' xml = gtk.glade.XML(GTKGUI_GLADE, 'service_discovery_window', APP) self.window = xml.get_widget('service_discovery_window') @@ -2134,9 +2147,10 @@ class Remove_account_window: def on_remove_button_clicked(self, widget): if gajim.connections[self.account].connected: - message = _("You're currently connected with %s.\nAre you sure you want to remove this account?") % self.account - dialog = dialogs.Confirmation_dialog(message) - if dialog.get_response() != gtk.RESPONSE_YES: + dialog = dialogs.Confirmation_dialog( + _('Account "%s" is connected to the server' % self.account), + _('If you remove it, the connection will be lost.')) + if dialog.get_response() != gtk.RESPONSE_OK: return gajim.connections[self.account].change_status('offline', 'offline') diff --git a/src/dialogs.py b/src/dialogs.py index c225db779..c3daee468 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -87,7 +87,8 @@ class Edit_groups_dialog: model = self.list.get_model() if model[path][1] and len(self.user.groups) == 1: # we try to remove # the last group - Error_dialog(_('A contact must belong at least to one group')) + Error_dialog(_("Can't remove last group"), + _('At least one contact group must be present.')).get_response() return model[path][1] = not model[path][1] if model[path][1]: @@ -241,7 +242,8 @@ class Add_new_contact_window: '''Class for Add_new_contact_window''' def __init__(self, plugin, account, jid = None): if gajim.connections[account].connected < 2: - Error_dialog(_('You must be connected to add a contact')) + Error_dialog(_('You are not connected to the server.'), \ + _('Without a connection, you can not add a contact')).get_response() return self.plugin = plugin self.account = account @@ -315,7 +317,8 @@ class Add_new_contact_window: if not jid: return if jid.find('@') < 0: - Error_dialog(_("The contact's name must be something like login@hostname")) + Error_dialog(_("Invalid user name"), +_('User names must be of the form "user@servername".')).get_response() return message_buffer = self.xml.get_widget('message_textview').get_buffer() start_iter = message_buffer.get_start_iter() @@ -369,8 +372,8 @@ class About_dialog: '''Class for about dialog''' def __init__(self): if gtk.pygtk_version < (2, 6, 0) or gtk.gtk_version < (2, 6, 0): - Information_dialog(_('Gajim - a GTK+ Jabber client\nVersion %s') \ - % gajim.version) + Information_dialog(_('Gajim - a GTK+ Jabber client'), + 'Version %s' % gajim.version).get_response() return dlg = gtk.AboutDialog() @@ -395,41 +398,86 @@ class About_dialog: rep = dlg.run() dlg.destroy() -class Confirmation_dialog: - '''Class for confirmation dialog''' - def get_response(self): - response = self.dialog.run() - self.dialog.destroy() - return response +class Dialog(gtk.Dialog): + def __init__(self, parent, title, buttons, default = None): + gtk.Dialog.__init__(self, title, parent, gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL | gtk.DIALOG_NO_SEPARATOR) - def __init__(self, label): - self.dialog = gtk.MessageDialog(None, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, label) + self.set_border_width(6) + self.vbox.set_spacing(12) + self.set_resizable(False) -class Warning_dialog: - '''Class for warning dialog''' - def on_response(self, dialog, response_id): - dialog.destroy() + for stock, response in buttons: + self.add_button(stock, response) - def __init__(self, label): - dialog = gtk.MessageDialog(None, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, label) - dialog.connect('response', self.on_response) - dialog.show() + if default is not None: + self.set_default_response(default) + else: + self.set_default_response(buttons[-1][1]) -class Information_dialog: - '''Class for information dialog''' - def on_response(self, dialog, response_id): - dialog.destroy() + def get_button(self, index): + buttons = self.action_area.get_children() + return index < len(buttons) and buttons[index] or None - def __init__(self, label): - dialog = gtk.MessageDialog(None, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, label) - dialog.connect('response', self.on_response) - dialog.show() +class HigDialog(Dialog): + def __init__(self, parent, pritext, sectext, stockimage, buttons, default = None): + """GNOME higified version of the Dialog object. Inherit + from here if possible when you need a new dialog.""" + Dialog.__init__(self, parent, "", buttons, default) + + # hbox separating dialog image and contents + hbox = gtk.HBox() + hbox.set_spacing(12) + hbox.set_border_width(6) + self.vbox.pack_start(hbox) + + # set up image + if stockimage is not None: + image = gtk.Image() + image.set_from_stock(stockimage, gtk.ICON_SIZE_DIALOG) + image.set_alignment(0.5, 0) + hbox.pack_start(image, False, False) + + # set up main content area + self.contents = gtk.VBox() + self.contents.set_spacing(10) + hbox.pack_start(self.contents) + + label = gtk.Label() + label.set_markup("" + pritext + "\n\n" + sectext) + label.set_line_wrap(True) + label.set_alignment(0, 0) + label.set_selectable(True) + self.contents.pack_start(label) + + def get_response(self): + self.show_all() + response = gtk.Dialog.run(self) + self.destroy() + return response + +class Confirmation_dialog(HigDialog): + def __init__(self, pritext, sectext=''): + """HIG compliant confirmation dialog.""" + HigDialog.__init__( + self, None, pritext, sectext, gtk.STOCK_DIALOG_WARNING, + [ [gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL], [ gtk.STOCK_OK, gtk.RESPONSE_OK ] ] + ) + +class Warning_dialog(HigDialog): + def __init__(self, pritext, sectext=''): + """HIG compliant warning dialog.""" + HigDialog.__init__( + self, None, pritext, sectext, gtk.STOCK_DIALOG_WARNING, + [ [ gtk.STOCK_OK, gtk.RESPONSE_OK ] ] + ) + +class Information_dialog(HigDialog): + def __init__(self, pritext, sectext=''): + """HIG compliant info dialog.""" + HigDialog.__init__( + self, None, pritext, sectext, gtk.STOCK_DIALOG_INFO, + [ [ gtk.STOCK_OK, gtk.RESPONSE_OK ] ] + ) class Input_dialog: '''Class for Input dialog''' @@ -444,17 +492,13 @@ class Input_dialog: self.input_entry.set_text(input_str) self.input_entry.select_region(0, -1) # select all -class Error_dialog: - '''Class for error dialog''' - def on_response(self, dialog, response_id): - dialog.destroy() - - def __init__(self, label): - dialog = gtk.MessageDialog(None, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, label) - dialog.connect('response', self.on_response) - dialog.show() +class Error_dialog(HigDialog): + def __init__(self, pritext, sectext=''): + """HIG compliant error dialog.""" + HigDialog.__init__( + self, None, pritext, sectext, gtk.STOCK_DIALOG_ERROR, + [ [ gtk.STOCK_OK, gtk.RESPONSE_OK ] ] + ) class Subscription_request_window: def __init__(self, plugin, jid, text, account): @@ -505,7 +549,8 @@ class Join_groupchat_window: self.plugin = plugin self.account = account if gajim.connections[account].connected < 2: - Error_dialog(_('You must be connected to join a groupchat')) + Error_dialog(_('You are not connected to the server'), +_('You can not join a group chat unless you are connected.')).get_response() raise RuntimeError, 'You must be connected to join a groupchat' self.xml = gtk.glade.XML(GTKGUI_GLADE, 'join_groupchat_window', APP) @@ -563,7 +608,7 @@ class Join_groupchat_window: password = self.xml.get_widget('password_entry').get_text() jid = '%s@%s' % (room, server) if jid in self.plugin.windows[self.account]['gc']: - Error_dialog(_('You are already in room ' + jid)) + Error_dialog(_('You are already in room ' + jid)).get_response() return if jid in self.recently_groupchat: self.recently_groupchat.remove(jid) @@ -581,7 +626,8 @@ class Join_groupchat_window: class New_message_dialog: def __init__(self, plugin, account): if gajim.connections[account].connected < 2: - Error_dialog(_('You must be connected to send a message to a contact')) + Error_dialog(_('You are not connected to the server'), + _('Without a connection, you can not send messages.')).get_response() return self.plugin = plugin self.account = account @@ -608,7 +654,8 @@ class New_message_dialog: '''When Chat button is clicked''' jid = self.jid_entry.get_text() if jid.find('@') == -1: # if no @ was given - Error_dialog(_('User ID is not valid')) + Error_dialog(_('Invalid user ID'), +_('User ID must be of the form "username@servername".')).get_response() return self.window.destroy() # use User class, new_chat expects it that way @@ -634,7 +681,8 @@ class New_message_dialog: class Change_password_dialog: def __init__(self, plugin, account): if gajim.connections[account].connected < 2: - Error_dialog(_('You must be connected to change your password')) + Error_dialog(_('You are not connected to the server'), +_('Without a connection, you can not change your password.')).get_response() return self.plugin = plugin self.account = account @@ -653,11 +701,13 @@ class Change_password_dialog: if rep == gtk.RESPONSE_OK: password1 = self.password1_entry.get_text() if not password1: - Error_dialog(_('Your password cannot be empty')) + Error_dialog(_('Invalid password.'), \ + _('You must enter a password.')).get_response() continue password2 = self.password2_entry.get_text() if password1 != password2: - Error_dialog(_('Confirmation password is not the same')) + Error_dialog(_("Passwords don't match."), \ + _('The passwords typed in both fields must be identical.')).get_response() continue message = password1 else: diff --git a/src/gajim.py b/src/gajim.py index 6762c754f..1ebb49f65 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -189,11 +189,11 @@ class Interface: self.roster.mklists(data, account) self.roster.draw_roster() - def handle_event_warning(self, unused, msg): - dialogs.Warning_dialog(msg) + def handle_event_warning(self, unused, msg, sectext=''): + dialogs.Warning_dialog(msg, sectext).get_response() - def handle_event_error(self, unused, msg): - dialogs.Error_dialog(msg) + def handle_event_error(self, unused, msg, sectext=''): + dialogs.Error_dialog(msg, sectext).get_response() def handle_event_error_answer(self, account, array): #('ERROR_ANSWER', account, (jid_from. errmsg, errcode)) @@ -412,10 +412,13 @@ class Interface: 'online', 'to', '', array[1], 0, keyID) self.roster.contacts[account][jid] = [user1] self.roster.add_user_to_roster(jid, account) - dialogs.Information_dialog(_('You are now authorized by %s') % jid) + dialogs.Information_dialog(_('Authorization accepted'), + _('The contact "%s" has authorized you to see his status.') + % jid).get_response() def handle_event_unsubscribed(self, account, jid): - dialogs.Information_dialog(_('You are now unsubscribed by %s') % jid) + dialogs.Information_dialog(_('Contact "%s" removed subscription' % jid), + _('You will always see contact "%s" as offline.')).get_response() def handle_event_agent_info(self, account, array): #('AGENT_INFO', account, (agent, identities, features, items)) @@ -428,7 +431,8 @@ class Interface: if array[1].has_key('instructions'): config.Service_registration_window(array[0], array[1], self, account) else: - dialogs.Error_dialog(_('error contacting %s') % array[0]) + dialogs.Error_dialog(_('Contact with "%s" cannot be established'\ +% array[0]), _('Check your connection or try again later.')).get_response() def handle_event_agent_info_items(self, account, array): #('AGENT_INFO_ITEMS', account, (agent, node, items)) @@ -445,7 +449,8 @@ class Interface: def handle_event_acc_ok(self, account, array): #('ACC_OK', account, (name, config)) name = array[0] - dialogs.Information_dialog(_('The account %s has been successfully registered') % name) + dialogs.Information_dialog(_('Account registration successful'), + _('The account "%s" has been registered with the Jabber server.') % name).get_response() gajim.config.add_per('accounts', name) for opt in array[1]: gajim.config.set_per('accounts', name, opt, array[1][opt]) @@ -519,7 +524,8 @@ class Interface: config.Groupchat_config_window(self, account, jid, array[1]) def handle_event_bad_passphrase(self, account, array): - dialogs.Warning_dialog(_('Your GPG passphrase is wrong, so you are connected without your GPG key')) + dialogs.Warning_dialog(_('Your GPG passphrase is incorrect'), + _('You are currently connected without your GPG key.')).get_response() def handle_event_roster_info(self, account, array): #('ROSTER_INFO', account, (jid, name, sub, ask, groups)) diff --git a/src/groupchat_window.py b/src/groupchat_window.py index 9ee5ff110..73f31f791 100644 --- a/src/groupchat_window.py +++ b/src/groupchat_window.py @@ -90,9 +90,10 @@ class Groupchat_window(chat.Chat): """close window""" for room_jid in self.xmls: if time.time() - self.last_message_time[room_jid] < 2: - dialog = dialogs.Confirmation_dialog(_('You received a message in the room %s in the last two seconds.\nDo you still want to close this window?') % \ + dialog = dialogs.Confirmation_dialog(_('You have unread messages in room "%s".'), \ + _('If you close this window, these messages will be lost.') % \ room_jid.split('@')[0]) - if dialog.get_response() != gtk.RESPONSE_YES: + if dialog.get_response() != gtk.RESPONSE_OK: return True #stop the propagation of the event for room_jid in self.xmls: gajim.connections[self.account].send_gc_status(self.nicks[room_jid], \ @@ -508,9 +509,11 @@ class Groupchat_window(chat.Chat): def remove_tab(self, room_jid): if time.time() - self.last_message_time[room_jid] < 2: - dialog = dialogs.Confirmation_dialog(_('You received a message in the room %s in the last two seconds.\nDo you still want to close this tab?') % \ + dialog = dialogs.Confirmation_dialog( + _('You have unread messages in room "%s"'), + _('If you close this tab, the messages will be lost.') % \ room_jid.split('@')[0]) - if dialog.get_response() != gtk.RESPONSE_YES: + if dialog.get_response() != gtk.RESPONSE_OK: return chat.Chat.remove_tab(self, room_jid, 'gc') diff --git a/src/roster_window.py b/src/roster_window.py index cc4a5c978..5816935c4 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -446,7 +446,7 @@ class Roster_window: def on_remove_agent(self, widget, user, account): '''When an agent is requested to log in or off''' - window = dialogs.Confirmation_dialog(_('Are you sure you want to unregister from "%s" transport?\nContacts from that transport will also be removed') % user.jid) + window = dialogs.Confirmation_dialog(_('Transport "%s" will be removed') % user.jid, _('You will no longer be able to send and receive messages to contacts from %s.' % user.jid)) if window.get_response() == gtk.RESPONSE_YES: gajim.connections[account].unsubscribe_agent(user.jid + '/' \ + user.resource) @@ -786,8 +786,10 @@ class Roster_window: def on_req_usub(self, widget, user, account): '''Remove a user''' - window = dialogs.Confirmation_dialog(_('Are you sure you want to remove %s (%s) from your roster?') % (user.name, user.jid)) - if window.get_response() == gtk.RESPONSE_YES: + window = dialogs.Confirmation_dialog(\ + _('Contact "%s" will be removed from your roster') % (user.name), + _('By removing this contact you also remove authorization. Contact "%s" will always see you as offline.') % user.name) + if window.get_response() == gtk.RESPONSE_OK: gajim.connections[account].unsubscribe(user.jid) for u in self.contacts[account][user.jid]: self.remove_user(u, account) @@ -894,7 +896,8 @@ class Roster_window: return accounts = gajim.connections.keys() if len(accounts) == 0: - dialogs.Error_dialog(_('You must create an account before connecting to jabber network.')) + dialogs.Error_dialog(_('No accounts created'), + _('You must create Jabber account before connecting the server.')).get_response() self.update_status_comboxbox() return status = model[active][2] @@ -1142,13 +1145,13 @@ class Roster_window: recent = True break if unread: - dialog = dialogs.Confirmation_dialog(_('You have unread messages.\nAre you sure you want to quit Gajim?')) - if dialog.get_response() != gtk.RESPONSE_YES: + dialog = dialogs.Confirmation_dialog(_('You have unread messages'), _('If you exit Gajim these messages will be lost.')) + if dialog.get_response() != gtk.RESPONSE_OK: return if recent: - dialog = dialogs.Confirmation_dialog(_('You received a message in the last two seconds.\nAre you sure you want to quit Gajim?')) - if dialog.get_response() != gtk.RESPONSE_YES: + dialog = dialogs.Confirmation_dialog(_('You have unread messages'), _('If you exit Gajim these messages will be lost.')) + if dialog.get_response() != gtk.RESPONSE_OK: return for acct in accounts: if gajim.connections[acct].connected: diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py index e9adfd1b0..446ae3559 100644 --- a/src/tabbed_chat_window.py +++ b/src/tabbed_chat_window.py @@ -123,8 +123,10 @@ class Tabbed_chat_window(chat.Chat): """close window""" for jid in self.users: if time.time() - self.last_message_time[jid] < 2: # 2 seconds - dialog = dialogs.Confirmation_dialog(_('You received a message from %s in the last two seconds.\nDo you still want to close this window?') % jid) - if dialog.get_response() != gtk.RESPONSE_YES: + dialog = dialogs.Confirmation_dialog( + _('You have an unread message from "%s"' % jid), + _('If you close the window, this message will be lost.')) + if dialog.get_response() != gtk.RESPONSE_OK: return True #stop the propagation of the event def on_tabbed_chat_window_destroy(self, widget): @@ -154,8 +156,10 @@ class Tabbed_chat_window(chat.Chat): def remove_tab(self, jid): if time.time() - self.last_message_time[jid] < 2: - dialog = dialogs.Confirmation_dialog(_('You received a message from %s in the last two seconds.\nDo you still want to close this tab?') % jid) - if dialog.get_response() != gtk.RESPONSE_YES: + dialog = dialogs.Confirmation_dialog( + _('You have an unread message from "%s"' % jid), + _('If you close this tab, the message will be lost.')) + if dialog.get_response() != gtk.RESPONSE_OK: return chat.Chat.remove_tab(self, jid, 'chats') @@ -228,7 +232,8 @@ class Tabbed_chat_window(chat.Chat): elif (event.state & gtk.gdk.SHIFT_MASK): return False if gajim.connections[self.account].connected < 2: #we are not connected - dialogs.Error_dialog(_('You are not connected, so you cannot send a message')) + dialogs.Error_dialog(_("You're connection has been lost."), \ + _("Your message can't be sent until you reconnect.")).get_response() return True message_buffer = widget.get_buffer() start_iter = message_buffer.get_start_iter() @@ -304,10 +309,10 @@ class Tabbed_chat_window(chat.Chat): def restore_conversation(self, jid): # don't restore lines if it's a transport - is_transport = jid.startswith('aim.') or jid.startswith('gadugadu.') or\ - jid.startswith('irc.') or jid.startswith('icq.') or\ - jid.startswith('msn.') or jid.startswith('sms.') or\ - jid.startswith('yahoo.') + is_transport = jid.startswith('aim') or jid.startswith('gadugadu') or\ + jid.startswith('irc') or jid.startswith('icq') or\ + jid.startswith('msn') or jid.startswith('sms') or\ + jid.startswith('yahoo') if is_transport: return diff --git a/src/vcard.py b/src/vcard.py index 9d3be6d34..f6afef78e 100644 --- a/src/vcard.py +++ b/src/vcard.py @@ -281,7 +281,8 @@ class Vcard_window: def on_publish_button_clicked(self, widget): if gajim.connections[self.account].connected < 2: - Error_dialog(_('You must be connected to publish your contact information')) + Error_dialog(_('You are not connected to the server'), + _('Without a connection you can not publish your contact information.')).get_response() return vcard = self.make_vcard() nick = '' @@ -307,7 +308,8 @@ class Vcard_window: self.xml.get_widget('DESC_textview').get_buffer().set_text('') gajim.connections[self.account].request_vcard(self.jid) else: - Error_dialog(_('You must be connected to get your contact information')) + Error_dialog(_('You are not connected to the server'), + _('Without a connection, you can not get your contact information.')).get_response() def change_to_vcard(self): self.xml.get_widget('information_notebook').remove_page(0)