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""" """Class for account informations"""
def on_account_modification_window_destroy(self, widget): def on_account_modification_window_destroy(self, widget):
"""close window""" """close window"""
del self.plugin.windows['account_modification'] del self.plugin.windows[self.account]['account_modification']
def on_cancel_button_clicked(self, widget): def on_cancel_button_clicked(self, widget):
self.window.destroy() self.window.destroy()
@ -1340,7 +1340,7 @@ class Accounts_window:
def on_new_button_clicked(self, widget): def on_new_button_clicked(self, widget):
"""When new button is clicked : open an account information window""" """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() self.plugin.windows['account_modification'].window.present()
else: else:
self.plugin.windows['account_modification'] = \ self.plugin.windows['account_modification'] = \
@ -1374,7 +1374,7 @@ class Accounts_window:
sel = self.accounts_treeview.get_selection() sel = self.accounts_treeview.get_selection()
(model, iter) = sel.get_selected() (model, iter) = sel.get_selected()
account = model.get_value(iter, 0) 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() self.plugin.windows[account]['account_modification'].window.present()
else: else:
self.plugin.windows[account]['account_modification'] = \ self.plugin.windows[account]['account_modification'] = \
@ -1628,15 +1628,65 @@ class Add_remove_emoticons_window:
class Service_discovery_window: class Service_discovery_window:
"""Class for 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): def on_service_discovery_window_destroy(self, widget):
"""close window""" """close window"""
del self.plugin.windows[self.account]['disco'] del self.plugin.windows[self.account]['disco']
def on_close_button_clicked(self, widget): def on_close_button_clicked(self, widget):
"""When Close button is clicked"""
self.window.destroy() 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): def browse(self, jid):
"""Send a request to the core to know the available services""" """Send a request to the core to know the available services"""
model = self.services_treeview.get_model() model = self.services_treeview.get_model()
@ -1842,54 +1892,3 @@ class Service_discovery_window:
self.services_treeview.get_model().clear() self.services_treeview.get_model().clear()
self.browse(server_address) self.browse(server_address)
self.plugin.save_config() 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.plugin = plugin
self.account = account self.account = account
self.user = user self.user = user
self.changes_made = False
self.list = self.xml.get_widget('groups_treeview') self.list = self.xml.get_widget('groups_treeview')
self.xml.get_widget('nickname_label').set_markup(\ self.xml.get_widget('nickname_label').set_markup(\
_('Contact\'s name: <i>%s</i>') % user.name) _('Contact\'s name: <i>%s</i>') % user.name)
@ -251,9 +252,9 @@ class Edit_groups_dialog:
def run(self): def run(self):
self.dialog.run() self.dialog.run()
self.dialog.destroy() self.dialog.destroy()
#TODO: do not send if unnecesary if self.changes_made:
gajim.connections[self.account].update_user(self.user.jid, \ gajim.connections[self.account].update_user(self.user.jid, \
self.user.name, self.user.groups) self.user.name, self.user.groups)
def update_user(self): def update_user(self):
self.plugin.roster.remove_user(self.user, self.account) self.plugin.roster.remove_user(self.user, self.account)
@ -275,6 +276,7 @@ class Edit_groups_dialog:
self.update_user() self.update_user()
def group_toggled_cb(self, cell, path): def group_toggled_cb(self, cell, path):
self.changes_made = True
model = self.list.get_model() model = self.list.get_model()
if model[path][1] and len(self.user.groups) == 1: # we try to remove if model[path][1] and len(self.user.groups) == 1: # we try to remove
# the latest group # the latest group

View File

@ -9204,7 +9204,7 @@ Custom</property>
<property name="height_request">0</property> <property name="height_request">0</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">Click for contact's extented information</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="use_underline">True</property>
<property name="relief">GTK_RELIEF_NONE</property> <property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property> <property name="focus_on_click">True</property>

View File

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

View File

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