when we change the iconset, change all the icons (in the roster, in the status combobox, in the systray, in (group)chat windows)
This commit is contained in:
parent
94ed80901f
commit
ce6f724620
|
@ -77,7 +77,7 @@ class Preferences_window:
|
|||
icon_string = model[active][0]
|
||||
self.plugin.config['iconset'] = icon_string
|
||||
self.plugin.roster.mkpixbufs()
|
||||
self.plugin.roster.draw_roster()
|
||||
self.plugin.roster.reload_pixbufs()
|
||||
|
||||
def on_account_text_colorbutton_color_set(self, widget):
|
||||
"""Take The Color For The Account Text"""
|
||||
|
|
|
@ -168,8 +168,8 @@ class Groupchat_window(Chat):
|
|||
role_iter = self.get_role_iter(room_jid, role)
|
||||
if not role_iter:
|
||||
role_iter = model.append(None, (self.plugin.roster.pixbufs['closed']\
|
||||
, role + 's', role))
|
||||
iter = model.append(role_iter, (img, nick, jid))
|
||||
, role + 's', role, ''))
|
||||
iter = model.append(role_iter, (img, nick, jid, show))
|
||||
self.list_treeview[room_jid].expand_row((model.get_path(role_iter)), \
|
||||
False)
|
||||
return iter
|
||||
|
@ -180,6 +180,23 @@ class Groupchat_window(Chat):
|
|||
iter = model.get_iter(path)
|
||||
return model.get_value(iter, 2)
|
||||
|
||||
def udpate_pixbufs(self):
|
||||
for room_jid in self.list_treeview:
|
||||
model = self.list_treeview[room_jid].get_model()
|
||||
role_iter = model.get_iter_root()
|
||||
if not role_iter:
|
||||
continue
|
||||
while role_iter:
|
||||
user_iter = model.iter_children(role_iter)
|
||||
if not user_iter:
|
||||
continue
|
||||
while user_iter:
|
||||
show = model.get_value(user_iter, 3)
|
||||
img = self.plugin.roster.pixbufs[show]
|
||||
model.set_value(user_iter, 0, img)
|
||||
user_iter = model.iter_next(user_iter)
|
||||
role_iter = model.iter_next(role_iter)
|
||||
|
||||
def chg_user_status(self, room_jid, nick, show, status, role, affiliation, \
|
||||
jid, reason, actor, statusCode, account):
|
||||
"""When a user change his status"""
|
||||
|
@ -204,6 +221,7 @@ class Groupchat_window(Chat):
|
|||
else:
|
||||
img = self.plugin.roster.pixbufs[show]
|
||||
model.set_value(iter, 0, img)
|
||||
model.set_value(iter, 3, show)
|
||||
|
||||
def set_subject(self, room_jid, subject):
|
||||
self.subjects[room_jid] = subject
|
||||
|
@ -428,8 +446,8 @@ class Groupchat_window(Chat):
|
|||
self.list_treeview[room_jid] = self.xmls[room_jid].\
|
||||
get_widget('list_treeview')
|
||||
|
||||
#status_image, nickname, real_jid
|
||||
store = gtk.TreeStore(gtk.Image, str, str)
|
||||
#status_image, nickname, real_jid, status
|
||||
store = gtk.TreeStore(gtk.Image, str, str, str)
|
||||
column = gtk.TreeViewColumn('contacts')
|
||||
render_text = ImageCellRenderer()
|
||||
column.pack_start(render_text, expand = False)
|
||||
|
|
|
@ -371,15 +371,7 @@ class Roster_window:
|
|||
self.redraw_jid(user.jid, account)
|
||||
#Print status in chat window
|
||||
if self.plugin.windows[account]['chats'].has_key(user.jid):
|
||||
prio = 0
|
||||
sho = luser[0].show
|
||||
for u in luser:
|
||||
if u.priority > prio:
|
||||
prio = u.priority
|
||||
sho = u.show
|
||||
img = self.pixbufs[sho]
|
||||
self.plugin.windows[account]['chats'][user.jid].\
|
||||
set_image(img, user.jid)
|
||||
self.plugin.windows[account]['chats'][user.jid].set_image(user.jid)
|
||||
name = user.name
|
||||
if user.resource != '':
|
||||
name += '/'+user.resource
|
||||
|
@ -1116,6 +1108,28 @@ class Roster_window:
|
|||
image.set_from_file(file)
|
||||
break
|
||||
|
||||
def reload_pixbufs(self):
|
||||
# Update the roster
|
||||
self.draw_roster()
|
||||
# Update the status combobox
|
||||
model = self.cb.get_model()
|
||||
iter = model.get_iter_root()
|
||||
while iter:
|
||||
model.set_value(iter, 1, self.pixbufs[model.get_value(iter, 2)])
|
||||
iter = model.iter_next(iter)
|
||||
# Update the systray
|
||||
if self.plugin.systray_enabled:
|
||||
self.plugin.systray.set_img()
|
||||
for account in self.plugin.accounts.keys():
|
||||
# Update opened chat windows
|
||||
for jid in self.plugin.windows[account]['chats']:
|
||||
if jid != 'tabbed':
|
||||
self.plugin.windows[account]['chats'][jid].set_image(jid)
|
||||
# Update opened groupchat windows
|
||||
for jid in self.plugin.windows[account]['gc']:
|
||||
if jid != 'tabbed':
|
||||
self.plugin.windows[account]['gc'][jid].udpate_pixbufs()
|
||||
|
||||
def sound_is_ok(self, sound):
|
||||
if not os.path.exists(sound):
|
||||
return 0
|
||||
|
|
|
@ -69,7 +69,15 @@ class Tabbed_chat_window(Chat):
|
|||
if not user.keyID:
|
||||
self.xmls[jid].get_widget('gpg_togglebutton').set_sensitive(False)
|
||||
|
||||
def set_image(self, image, jid):
|
||||
def set_image(self, jid):
|
||||
prio = 0
|
||||
list_users = self.plugin.roster.contacts[self.account][jid]
|
||||
sho = list_users[0].show
|
||||
for u in list_users:
|
||||
if u.priority > prio:
|
||||
prio = u.priority
|
||||
sho = u.show
|
||||
image = self.plugin.roster.pixbufs[sho]
|
||||
if image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
||||
self.xmls[jid].get_widget('status_image').\
|
||||
set_from_animation(image.get_animation())
|
||||
|
|
Loading…
Reference in New Issue