typos and small fixes (mostly: edit groups dont send changes if nothing changed) allover

This commit is contained in:
Nikos Kouremenos 2005-04-17 21:31:18 +00:00
parent 7f8e130d19
commit f1fdb97fc4
5 changed files with 92 additions and 86 deletions

View File

@ -895,7 +895,7 @@ class Account_modification_window:
"""Class for account informations"""
def on_account_modification_window_destroy(self, widget):
"""close window"""
del self.plugin.windows['account_modification']
del self.plugin.windows[self.account]['account_modification']
def on_cancel_button_clicked(self, widget):
self.window.destroy()
@ -1340,7 +1340,7 @@ class Accounts_window:
def on_new_button_clicked(self, widget):
"""When new button is clicked : open an account information window"""
if self.plugin.windows.has_key('account_modification_window'):
if self.plugin.windows.has_key('account_modification'):
self.plugin.windows['account_modification'].window.present()
else:
self.plugin.windows['account_modification'] = \
@ -1374,7 +1374,7 @@ class Accounts_window:
sel = self.accounts_treeview.get_selection()
(model, iter) = sel.get_selected()
account = model.get_value(iter, 0)
if self.plugin.windows[account].has_key('account_modification_window'):
if self.plugin.windows[account].has_key('account_modification'):
self.plugin.windows[account]['account_modification'].window.present()
else:
self.plugin.windows[account]['account_modification'] = \
@ -1628,14 +1628,64 @@ class Add_remove_emoticons_window:
class Service_discovery_window:
"""Class for Service Discovery Window:
to know the services on the selected server"""
to know the services on a server"""
def on_service_discovery_window_destroy(self, widget):
"""close window"""
del self.plugin.windows[self.account]['disco']
def on_close_button_clicked(self, widget):
"""When Close button is clicked"""
self.window.destroy()
def __init__(self, plugin, account):
if gajim.connections[account].connected < 2:
dialog.Error_dialog(_('You must be connected to browse services'))
return
xml = gtk.glade.XML(GTKGUI_GLADE, 'service_discovery_window', APP)
self.window = xml.get_widget('service_discovery_window')
self.services_treeview = xml.get_widget('services_treeview')
self.join_button = xml.get_widget('join_button')
self.register_button = xml.get_widget('register_button')
self.address_comboboxentry = xml.get_widget('address_comboboxentry')
self.address_comboboxentry_entry = self.address_comboboxentry.child
self.address_comboboxentry_entry.set_activates_default(True)
self.plugin = plugin
self.account = account
self.agent_infos = {}
model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
self.services_treeview.set_model(model)
#columns
renderer = gtk.CellRendererText()
renderer.set_data('column', 0)
self.services_treeview.insert_column_with_attributes(-1, 'Name', \
renderer, text=0)
renderer = gtk.CellRendererText()
renderer.set_data('column', 1)
self.services_treeview.insert_column_with_attributes(-1, 'Service', \
renderer, text=1)
self.address_comboboxentry = xml.get_widget('address_comboboxentry')
liststore = gtk.ListStore(str)
self.address_comboboxentry.set_model(liststore)
self.address_comboboxentry.set_text_column(0)
self.latest_addresses = gajim.config.get('latest_disco_addresses').split()
server_address = gajim.config.get_per('accounts', self.account, \
'hostname')
if server_address in self.latest_addresses:
self.latest_addresses.remove(server_address)
self.latest_addresses.insert(0, server_address)
if len(self.latest_addresses) > 10:
self.latest_addresses = self.latest_addresses[0:10]
for j in self.latest_addresses:
self.address_comboboxentry.append_text(j)
self.address_comboboxentry.child.set_text(server_address)
self.register_button = xml.get_widget('register_button')
self.register_button.set_sensitive(False)
self.join_button = xml.get_widget('join_button')
self.join_button.set_sensitive(False)
xml.signal_autoconnect(self)
self.browse(server_address)
self.window.show_all()
def browse(self, jid):
"""Send a request to the core to know the available services"""
@ -1842,54 +1892,3 @@ class Service_discovery_window:
self.services_treeview.get_model().clear()
self.browse(server_address)
self.plugin.save_config()
def __init__(self, plugin, account):
if gajim.connections[account].connected < 2:
dialog.Error_dialog(_('You must be connected to browse services'))
return
xml = gtk.glade.XML(GTKGUI_GLADE, 'service_discovery_window', APP)
self.window = xml.get_widget('service_discovery_window')
self.services_treeview = xml.get_widget('services_treeview')
self.join_button = xml.get_widget('join_button')
self.register_button = xml.get_widget('register_button')
self.address_comboboxentry = xml.get_widget('address_comboboxentry')
self.address_comboboxentry_entry = self.address_comboboxentry.child
self.address_comboboxentry_entry.set_activates_default(True)
self.plugin = plugin
self.account = account
self.agent_infos = {}
model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
self.services_treeview.set_model(model)
#columns
renderer = gtk.CellRendererText()
renderer.set_data('column', 0)
self.services_treeview.insert_column_with_attributes(-1, 'Name', \
renderer, text=0)
renderer = gtk.CellRendererText()
renderer.set_data('column', 1)
self.services_treeview.insert_column_with_attributes(-1, 'Service', \
renderer, text=1)
self.address_comboboxentry = xml.get_widget('address_comboboxentry')
liststore = gtk.ListStore(str)
self.address_comboboxentry.set_model(liststore)
self.address_comboboxentry.set_text_column(0)
self.latest_addresses = gajim.config.get('latest_disco_addresses').split()
server_address = gajim.config.get_per('accounts', self.account, \
'hostname')
if server_address in self.latest_addresses:
self.latest_addresses.remove(server_address)
self.latest_addresses.insert(0, server_address)
if len(self.latest_addresses) > 10:
self.latest_addresses = self.latest_addresses[0:10]
for j in self.latest_addresses:
self.address_comboboxentry.append_text(j)
self.address_comboboxentry.child.set_text(server_address)
self.register_button = xml.get_widget('register_button')
self.register_button.set_sensitive(False)
self.join_button = xml.get_widget('join_button')
self.join_button.set_sensitive(False)
xml.signal_autoconnect(self)
self.browse(server_address)
self.window.show_all()

View File

@ -239,6 +239,7 @@ class Edit_groups_dialog:
self.plugin = plugin
self.account = account
self.user = user
self.changes_made = False
self.list = self.xml.get_widget('groups_treeview')
self.xml.get_widget('nickname_label').set_markup(\
_('Contact\'s name: <i>%s</i>') % user.name)
@ -251,9 +252,9 @@ class Edit_groups_dialog:
def run(self):
self.dialog.run()
self.dialog.destroy()
#TODO: do not send if unnecesary
gajim.connections[self.account].update_user(self.user.jid, \
self.user.name, self.user.groups)
if self.changes_made:
gajim.connections[self.account].update_user(self.user.jid, \
self.user.name, self.user.groups)
def update_user(self):
self.plugin.roster.remove_user(self.user, self.account)
@ -275,6 +276,7 @@ class Edit_groups_dialog:
self.update_user()
def group_toggled_cb(self, cell, path):
self.changes_made = True
model = self.list.get_model()
if model[path][1] and len(self.user.groups) == 1: # we try to remove
# the latest group

View File

@ -9204,7 +9204,7 @@ Custom</property>
<property name="height_request">0</property>
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Click for contact's extented information</property>
<property name="label" translatable="yes">Anonymous &lt;id@server/res&gt;</property>
<property name="label" translatable="yes">Anonymous &lt;nick@server/res&gt;</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>

View File

@ -313,27 +313,31 @@ class interface:
elif self.roster.contacts[account].has_key(ji):
#It isn't an agent
self.roster.chg_user_status(user1, array[1], array[2], account)
#play sound
if old_show < 2 and new_show > 1 and gajim.config.get_per( \
'soundevents', 'contact_connected', 'enabled'):
self.play_sound('contact_connected')
#inform the user about new contact online
if old_show < 2 and new_show > 1:
if gajim.config.get_per('soundevents', 'contact_connected', \
'enabled'):
self.play_sound('contact_connected')
if not self.windows[account]['chats'].has_key(jid) and \
not self.queues[account].has_key(jid) and \
gajim.config.get('notify_on_online') and \
gajim.config.get('autopopupaway'):
instance = dialogs.Popup_window(self, 'Contact Online', jid, \
account)
self.roster.popup_windows.append(instance)
elif old_show > 1 and new_show < 2 and gajim.config.get_per( \
'soundevents', 'contact_disconnected', 'enabled'):
self.play_sound('contact_disconnected')
if not self.windows[account]['chats'].has_key(jid) and \
not self.queues[account].has_key(jid) and \
gajim.config.get('notify_on_offline') and \
gajim.config.get('autopopupaway'):
instance = dialogs.Popup_window(self, 'Contact Offline', jid, \
account)
self.roster.popup_windows.append(instance)
gajim.config.get('notify_on_online'):
#FIXME: check what is OUR STATUS and do the rest
if gajim.config.get('autopopupaway'):
instance = dialogs.Popup_window(self, 'Contact Online', jid, \
account)
self.roster.popup_windows.append(instance)
elif old_show > 1 and new_show < 2:
if gajim.config.get_per('soundevents', 'contact_disconnected', \
'enabled'):
self.play_sound('contact_disconnected')
if not self.windows[account]['chats'].has_key(jid) and \
not self.queues[account].has_key(jid) and \
gajim.config.get('notify_on_offline'):
#FIXME: check what is OUR STATUS and do the rest
if gajim.config.get('autopopupaway'):
instance = dialogs.Popup_window(self, 'Contact Offline', jid, \
account)
self.roster.popup_windows.append(instance)
elif self.windows[account]['gc'].has_key(ji):
#it is a groupchat presence
@ -354,10 +358,11 @@ class interface:
if not self.windows[account]['chats'].has_key(jid) and \
not self.queues[account].has_key(jid):
first = True
if gajim.config.get('notify_on_new_message') and \
gajim.config.get('autopopupaway'):
instance = dialogs.Popup_window(self, 'New Message', jid, account)
self.roster.popup_windows.append(instance)
if gajim.config.get('notify_on_new_message'):
#FIXME: check what is OUR STATUS (if we're online) and do the rest
if gajim.config.get('autopopupaway'):
instance = dialogs.Popup_window(self, 'New Message', jid, account)
self.roster.popup_windows.append(instance)
self.roster.on_message(jid, array[1], array[2], account)
if gajim.config.get_per('soundevents', 'first_message_received', \
'enabled') and first:
@ -743,7 +748,7 @@ class interface:
# get instances for windows/dialogs that will show_all()/hide()
self.windows['preferences'] = config.Preferences_window(self)
self.windows['add_remove_emoticons_window'] = \
self.windows['add_remove_emoticons'] = \
config.Add_remove_emoticons_window(self)
self.windows['roster'] = self.roster

View File

@ -530,7 +530,7 @@ class Roster_window:
menu.reposition()
def on_edit_account(self, widget, account):
if self.plugin.windows.has_key('account_modification_window'):
if self.plugin.windows.has_key('account_modification'):
self.plugin.windows['account_modification'].window.present()
else:
self.plugin.windows['account_modification'] = \
@ -879,7 +879,7 @@ class Roster_window:
path = None
autopopup = gajim.config.get('autopopup')
autopopupaway = gajim.config.get('autopopupaway')
if (autopopup == 0 or ( not autopopupaway and \
if (not autopopup or ( not autopopupaway and \
gajim.connections[account].connected > 2)) and not \
self.plugin.windows[account]['chats'].has_key(jid):
#We save it in a queue