Don't allow to send custom presence ton group "groupchats". Fix #3231.

This commit is contained in:
Julien Pivotto 2007-06-11 10:46:47 +00:00
parent 6338f63f03
commit 981045005c
1 changed files with 26 additions and 30 deletions

View File

@ -16,7 +16,6 @@
## ##
import gtk import gtk
import pango
import gobject import gobject
import os import os
import time import time
@ -1187,8 +1186,6 @@ class RosterWindow:
for acct in gajim.connections: for acct in gajim.connections:
self.add_account_to_roster(acct) self.add_account_to_roster(acct)
self.add_account_contacts(acct) self.add_account_contacts(acct)
# Recalculate column width for ellipsizing
self.tree.columns_autosize()
def add_account_contacts(self, account): def add_account_contacts(self, account):
'''adds contacts of group to roster treeview''' '''adds contacts of group to roster treeview'''
@ -2557,32 +2554,32 @@ class RosterWindow:
group_message_to_all_item.connect('activate', group_message_to_all_item.connect('activate',
self.on_send_single_message_menuitem_activate, account, list_) self.on_send_single_message_menuitem_activate, account, list_)
# Send Custom Status # Send Custom Status
send_custom_status_menuitem = gtk.ImageMenuItem(_('Send Cus_tom Status')) send_custom_status_menuitem = gtk.ImageMenuItem(_('Send Cus_tom Status'))
# add a special img for this menuitem # add a special img for this menuitem
if group in gajim.connections[account].blocked_groups: if group in gajim.connections[account].blocked_groups:
send_custom_status_menuitem.set_image(self.load_icon('offline')) send_custom_status_menuitem.set_image(self.load_icon('offline'))
send_custom_status_menuitem.set_sensitive(False) send_custom_status_menuitem.set_sensitive(False)
elif gajim.interface.status_sent_to_groups.has_key(account) and \ elif gajim.interface.status_sent_to_groups.has_key(account) and \
group in gajim.interface.status_sent_to_groups[account]: group in gajim.interface.status_sent_to_groups[account]:
send_custom_status_menuitem.set_image(self.load_icon( send_custom_status_menuitem.set_image(self.load_icon(
gajim.interface.status_sent_to_groups[account][group])) gajim.interface.status_sent_to_groups[account][group]))
else: else:
send_custom_status_menuitem.set_image(None) send_custom_status_menuitem.set_image(None)
status_menuitems = gtk.Menu() status_menuitems = gtk.Menu()
send_custom_status_menuitem.set_submenu(status_menuitems) send_custom_status_menuitem.set_submenu(status_menuitems)
iconset = gajim.config.get('iconset') iconset = gajim.config.get('iconset')
path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16') path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16')
for s in ['online', 'chat', 'away', 'xa', 'dnd', 'offline']: for s in ['online', 'chat', 'away', 'xa', 'dnd', 'offline']:
# icon MUST be different instance for every item # icon MUST be different instance for every item
state_images = self.load_iconset(path) state_images = self.load_iconset(path)
status_menuitem = gtk.ImageMenuItem(helpers.get_uf_show(s)) status_menuitem = gtk.ImageMenuItem(helpers.get_uf_show(s))
status_menuitem.connect('activate', self.on_send_custom_status, list_, status_menuitem.connect('activate', self.on_send_custom_status, list_,
s, group) s, group)
icon = state_images[s] icon = state_images[s]
status_menuitem.set_image(icon) status_menuitem.set_image(icon)
status_menuitems.append(status_menuitem) status_menuitems.append(status_menuitem)
menu.append(send_custom_status_menuitem) menu.append(send_custom_status_menuitem)
if not group in helpers.special_groups + (_('General'),): if not group in helpers.special_groups + (_('General'),):
item = gtk.SeparatorMenuItem() # separator item = gtk.SeparatorMenuItem() # separator
@ -5042,7 +5039,6 @@ class RosterWindow:
col.set_cell_data_func(render_image, self.iconCellDataFunc, None) col.set_cell_data_func(render_image, self.iconCellDataFunc, None)
render_text = gtk.CellRendererText() # contact or group or account name render_text = gtk.CellRendererText() # contact or group or account name
render_text.set_property("ellipsize", pango.ELLIPSIZE_END)
col.pack_start(render_text, expand = True) col.pack_start(render_text, expand = True)
col.add_attribute(render_text, 'markup', C_NAME) # where we hold the name col.add_attribute(render_text, 'markup', C_NAME) # where we hold the name
col.set_cell_data_func(render_text, self.nameCellDataFunc, None) col.set_cell_data_func(render_text, self.nameCellDataFunc, None)