I tried to make gajim more HCI friendly. ERRORS use Error dialog and not warning dialog. Need core implementation too. Also other fixes. plz see a comment for you yann (sre)

This commit is contained in:
Nikos Kouremenos 2005-03-16 01:27:37 +00:00
parent ab1e1a09fb
commit 9e91c026b8
6 changed files with 46 additions and 41 deletions

View File

@ -90,9 +90,13 @@ class Chat:
elif unread == 1: elif unread == 1:
start = "* " start = "* "
chat = self.names[jid] chat = self.names[jid]
if len(self.xmls) > 1: if len(self.xmls) > 1: # if more than one tabs in the same window
chat = 'Chat' chat = 'Chat'
self.window.set_title(start + chat + ' (' + self.account + ')') if len(self.plugin.accounts.keys()) >= 2: # if we have 2 or more accounts
title = start + chat + ' (account: ' + self.account + ')'
else:
title = start + chat
self.window.set_title(title)
def redraw_tab(self, jid): def redraw_tab(self, jid):
"""redraw the label of the tab""" """redraw the label of the tab"""

View File

@ -1067,26 +1067,26 @@ class Account_modification_window:
proxyhost = self.xml.get_widget('proxyhost_entry').get_text() proxyhost = self.xml.get_widget('proxyhost_entry').get_text()
proxyport = self.xml.get_widget('proxyport_entry').get_text() proxyport = self.xml.get_widget('proxyport_entry').get_text()
if (name == ''): if (name == ''):
Warning_dialog(_('You must enter a name for this account')) Error_dialog(_('You must enter a name for this account'))
return 0 return
if name.find(' ') != -1: if name.find(' ') != -1:
Warning_dialog(_('Spaces are not permited in account name')) Error_dialog(_('Spaces are not permited in account name'))
return 0 return
if (jid == '') or (jid.count('@') != 1): if (jid == '') or (jid.count('@') != 1):
Warning_dialog(_('You must enter a Jabber ID for this account\nFor example: someone@someserver.org')) Error_dialog(_('You must enter a Jabber ID for this account\nFor example: someone@someserver.org'))
return 0 return
if new_account_checkbutton.get_active() and password == '': if new_account_checkbutton.get_active() and password == '':
Warning_dialog(_('You must enter a password to register a new account')) Error_dialog(_('You must enter a password to register a new account'))
return 0 return
if use_proxy: if use_proxy:
if proxyport != '': if proxyport != '':
try: try:
proxyport = int(proxyport) proxyport = int(proxyport)
except ValueError: except ValueError:
Warning_dialog(_('Proxy Port must be a port number')) Error_dialog(_('Proxy Port must be a port number'))
return 0 return
if proxyhost == '': if proxyhost == '':
Warning_dialog(_('You must enter a proxy host to use proxy')) Error_dialog(_('You must enter a proxy host to use proxy'))
(login, hostname) = jid.split('@') (login, hostname) = jid.split('@')
key_name = self.xml.get_widget('gpg_name_label').get_text() key_name = self.xml.get_widget('gpg_name_label').get_text()
@ -1145,7 +1145,7 @@ class Account_modification_window:
return return
#if it's a new account #if it's a new account
if name in self.plugin.accounts.keys(): if name in self.plugin.accounts.keys():
Warning_dialog(_('An account already has this name')) Error_dialog(_('An account already has this name'))
return return
#if we neeed to register a new account #if we neeed to register a new account
if new_account_checkbutton.get_active(): if new_account_checkbutton.get_active():
@ -1234,11 +1234,11 @@ class Account_modification_window:
def on_edit_details_button_clicked(self, widget): def on_edit_details_button_clicked(self, widget):
if not self.plugin.windows.has_key(self.account): if not self.plugin.windows.has_key(self.account):
Warning_dialog(_('You must first create your account before editing your information')) Error_dialog(_('You must first create your account before editing your information'))
return return
jid = self.xml.get_widget('jid_entry').get_text() jid = self.xml.get_widget('jid_entry').get_text()
if self.plugin.connected[self.account] < 2: if self.plugin.connected[self.account] < 2:
Warning_dialog(_('You must be connected to edit your information')) Error_dialog(_('You must be connected to edit your information'))
return return
if not self.plugin.windows[self.account]['infos'].has_key('vcard'): if not self.plugin.windows[self.account]['infos'].has_key('vcard'):
self.plugin.windows[self.account]['infos'][jid] = \ self.plugin.windows[self.account]['infos'][jid] = \
@ -1579,7 +1579,7 @@ class agent_browser_window:
def __init__(self, plugin, account): def __init__(self, plugin, account):
if plugin.connected[account] < 2: if plugin.connected[account] < 2:
Warning_dialog(_("You must be connected to view Agents")) Error_dialog(_("You must be connected to view Agents"))
return return
xml = gtk.glade.XML(GTKGUI_GLADE, 'agent_browser_window', APP) xml = gtk.glade.XML(GTKGUI_GLADE, 'agent_browser_window', APP)
self.window = xml.get_widget('agent_browser_window') self.window = xml.get_widget('agent_browser_window')

View File

@ -151,7 +151,7 @@ class vcard_information_window:
def on_publish_button_clicked(self, widget): def on_publish_button_clicked(self, widget):
if self.plugin.connected[self.account] < 2: if self.plugin.connected[self.account] < 2:
Warning_dialog(_("You must be connected to publish your informations")) Error_dialog(_("You must be connected to publish your informations"))
return return
vcard = self.make_vcard() vcard = self.make_vcard()
nick = '' nick = ''
@ -166,7 +166,7 @@ class vcard_information_window:
if self.plugin.connected[self.account] > 1: if self.plugin.connected[self.account] > 1:
self.plugin.send('ASK_VCARD', self.account, self.jid) self.plugin.send('ASK_VCARD', self.account, self.jid)
else: else:
Warning_dialog(_('You must be connected to get your informations')) Error_dialog(_('You must be connected to get your informations'))
def change_to_vcard(self): def change_to_vcard(self):
self.xml.get_widget('information_notebook').remove_page(0) self.xml.get_widget('information_notebook').remove_page(0)
@ -237,7 +237,7 @@ class Passphrase_dialog:
self.xml.signal_autoconnect(self) self.xml.signal_autoconnect(self)
class choose_gpg_key_dialog: class choose_gpg_key_dialog:
"""Class for Away Message Window""" """Class for GPG key dialog"""
def run(self): def run(self):
"""Wait for Ok button to be pressed and return the selected key""" """Wait for Ok button to be pressed and return the selected key"""
rep = self.window.run() rep = self.window.run()
@ -270,7 +270,7 @@ class choose_gpg_key_dialog:
self.keys_treeview.insert_column_with_attributes(-1, _('User name'), \ self.keys_treeview.insert_column_with_attributes(-1, _('User name'), \
renderer, text=1) renderer, text=1)
class Away_message_dialog: class Change_status_message_dialog:
"""Class for Away message dialog""" """Class for Away message dialog"""
def run(self): def run(self):
"""Wait for OK button to be pressed and return away messsage""" """Wait for OK button to be pressed and return away messsage"""
@ -296,14 +296,15 @@ class Away_message_dialog:
name = model[active][0] name = model[active][0]
self.message_buffer.set_text(self.values[name]) self.message_buffer.set_text(self.values[name])
def on_away_message_dialog_key_press_event(self, widget, event): def on_change_status_message_dialog_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Return: if event.keyval == gtk.keysyms.Return: # catch CTRL+ENTER
if (event.state & gtk.gdk.CONTROL_MASK): if (event.state & gtk.gdk.CONTROL_MASK):
self.window.response(gtk.RESPONSE_OK) self.window.response(gtk.RESPONSE_OK)
def __init__(self, plugin, autoconnect = 0): def __init__(self, plugin, status, autoconnect = 0):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'away_message_dialog', APP) self.xml = gtk.glade.XML(GTKGUI_GLADE, 'change_status_message_dialog', APP)
self.window = self.xml.get_widget('away_message_dialog') self.window = self.xml.get_widget('change_status_message_dialog')
self.window.set_title(status.capitalize() + ' Status Message')
self.plugin = plugin self.plugin = plugin
self.autoconnect = autoconnect self.autoconnect = autoconnect
message_textview = self.xml.get_widget('message_textview') message_textview = self.xml.get_widget('message_textview')
@ -336,7 +337,7 @@ class add_contact_window:
if not jid: if not jid:
return return
if jid.find('@') < 0: if jid.find('@') < 0:
Warning_dialog(_("The contact's name must be something like login@hostname")) Error_dialog(_("The contact's name must be something like login@hostname"))
return return
message_buffer = self.xml.get_widget('message_textview').get_buffer() message_buffer = self.xml.get_widget('message_textview').get_buffer()
start_iter = message_buffer.get_start_iter() start_iter = message_buffer.get_start_iter()
@ -393,7 +394,7 @@ class add_contact_window:
def __init__(self, plugin, account, jid=None): def __init__(self, plugin, account, jid=None):
if plugin.connected[account] < 2: if plugin.connected[account] < 2:
Warning_dialog(_('You must be connected to add a contact')) Error_dialog(_('You must be connected to add a contact'))
return return
self.plugin = plugin self.plugin = plugin
self.account = account self.account = account
@ -569,7 +570,7 @@ class join_groupchat_window:
def __init__(self, plugin, account, server='', room = ''): def __init__(self, plugin, account, server='', room = ''):
if plugin.connected[account] < 2: if plugin.connected[account] < 2:
Warning_dialog(_('You must be connected to join a group chat')) Error_dialog(_('You must be connected to join a group chat'))
return return
self.plugin = plugin self.plugin = plugin
self.account = account self.account = account
@ -613,7 +614,7 @@ class New_message_dialog:
def __init__(self, plugin, account): def __init__(self, plugin, account):
if plugin.connected[account] < 2: if plugin.connected[account] < 2:
Warning_dialog(_('You must be connected to send a message to a contact')) Error_dialog(_('You must be connected to send a message to a contact'))
return return
self.plugin = plugin self.plugin = plugin
self.account = account self.account = account
@ -632,11 +633,11 @@ class Change_password_dialog:
if rep == gtk.RESPONSE_OK: if rep == gtk.RESPONSE_OK:
password1 = self.password1_entry.get_text() password1 = self.password1_entry.get_text()
if not password1: if not password1:
Warning_dialog(_('Your password cannot be empty')) Error_dialog(_('Your password cannot be empty'))
continue continue
password2 = self.password2_entry.get_text() password2 = self.password2_entry.get_text()
if password1 != password2: if password1 != password2:
Warning_dialog(_('Your passwords are not the same')) Error_dialog(_('Confirmation password is not the same'))
continue continue
message = password1 message = password1
else: else:
@ -647,7 +648,7 @@ class Change_password_dialog:
def __init__(self, plugin, account): def __init__(self, plugin, account):
if plugin.connected[account] < 2: if plugin.connected[account] < 2:
Warning_dialog(_('You must be connected to change your password')) Error_dialog(_('You must be connected to change your password'))
return return
self.plugin = plugin self.plugin = plugin
self.account = account self.account = account

View File

@ -23,7 +23,7 @@ import gtk.glade
import pango import pango
import gobject import gobject
import time import time
import sre #usefull later import sre #usefull later #(nk) really? :)
from dialogs import * from dialogs import *
from chat import * from chat import *

View File

@ -7819,12 +7819,12 @@ Custom</property>
</child> </child>
</widget> </widget>
<widget class="GtkDialog" id="away_message_dialog"> <widget class="GtkDialog" id="change_status_message_dialog">
<property name="border_width">4</property> <property name="border_width">4</property>
<property name="width_request">303</property> <property name="width_request">303</property>
<property name="height_request">225</property> <property name="height_request">225</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="title" translatable="yes">Message</property> <property name="title" translatable="yes">Status Message for</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property> <property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property> <property name="modal">False</property>
@ -7836,7 +7836,7 @@ Custom</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">True</property> <property name="has_separator">True</property>
<signal name="key_press_event" handler="on_away_message_dialog_key_press_event" last_modification_time="Wed, 02 Mar 2005 12:35:32 GMT"/> <signal name="key_press_event" handler="on_change_status_message_dialog_key_press_event" last_modification_time="Wed, 16 Mar 2005 00:53:06 GMT"/>
<child internal-child="vbox"> <child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox5"> <widget class="GtkVBox" id="dialog-vbox5">
@ -7881,7 +7881,7 @@ Custom</property>
<child> <child>
<widget class="GtkLabel" id="label164"> <widget class="GtkLabel" id="label164">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Enter your message :</property> <property name="label" translatable="yes">Enter your message:</property>
<property name="use_underline">False</property> <property name="use_underline">False</property>
<property name="use_markup">False</property> <property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
@ -7938,7 +7938,7 @@ Custom</property>
<child> <child>
<widget class="GtkLabel" id="label165"> <widget class="GtkLabel" id="label165">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Or choose your message :</property> <property name="label" translatable="yes">Or choose your message:</property>
<property name="use_underline">False</property> <property name="use_underline">False</property>
<property name="use_markup">False</property> <property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="justify">GTK_JUSTIFY_LEFT</property>

View File

@ -730,8 +730,8 @@ class roster_window:
or (status == 'offline' and not \ or (status == 'offline' and not \
self.plugin.config['ask_offline_status']): self.plugin.config['ask_offline_status']):
return status return status
w = Away_message_dialog(self.plugin, autoconnect) dlg = Change_status_message_dialog(self.plugin, status, autoconnect)
message = w.run() message = dlg.run()
return message return message
def change_status(self, widget, account, status): def change_status(self, widget, account, status):