Skip to content
Snippets Groups Projects
Commit ce6f7246 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

when we change the iconset, change all the icons (in the roster, in the status...

when we change the iconset, change all the icons (in the roster, in the status combobox, in the systray, in (group)chat windows)
parent 94ed8090
No related branches found
No related tags found
No related merge requests found
...@@ -77,7 +77,7 @@ class Preferences_window: ...@@ -77,7 +77,7 @@ class Preferences_window:
icon_string = model[active][0] icon_string = model[active][0]
self.plugin.config['iconset'] = icon_string self.plugin.config['iconset'] = icon_string
self.plugin.roster.mkpixbufs() self.plugin.roster.mkpixbufs()
self.plugin.roster.draw_roster() self.plugin.roster.reload_pixbufs()
def on_account_text_colorbutton_color_set(self, widget): def on_account_text_colorbutton_color_set(self, widget):
"""Take The Color For The Account Text""" """Take The Color For The Account Text"""
......
...@@ -168,8 +168,8 @@ class Groupchat_window(Chat): ...@@ -168,8 +168,8 @@ class Groupchat_window(Chat):
role_iter = self.get_role_iter(room_jid, role) role_iter = self.get_role_iter(room_jid, role)
if not role_iter: if not role_iter:
role_iter = model.append(None, (self.plugin.roster.pixbufs['closed']\ role_iter = model.append(None, (self.plugin.roster.pixbufs['closed']\
, role + 's', role)) , role + 's', role, ''))
iter = model.append(role_iter, (img, nick, jid)) iter = model.append(role_iter, (img, nick, jid, show))
self.list_treeview[room_jid].expand_row((model.get_path(role_iter)), \ self.list_treeview[room_jid].expand_row((model.get_path(role_iter)), \
False) False)
return iter return iter
...@@ -180,6 +180,23 @@ class Groupchat_window(Chat): ...@@ -180,6 +180,23 @@ class Groupchat_window(Chat):
iter = model.get_iter(path) iter = model.get_iter(path)
return model.get_value(iter, 2) 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, \ def chg_user_status(self, room_jid, nick, show, status, role, affiliation, \
jid, reason, actor, statusCode, account): jid, reason, actor, statusCode, account):
"""When a user change his status""" """When a user change his status"""
...@@ -204,6 +221,7 @@ class Groupchat_window(Chat): ...@@ -204,6 +221,7 @@ class Groupchat_window(Chat):
else: else:
img = self.plugin.roster.pixbufs[show] img = self.plugin.roster.pixbufs[show]
model.set_value(iter, 0, img) model.set_value(iter, 0, img)
model.set_value(iter, 3, show)
def set_subject(self, room_jid, subject): def set_subject(self, room_jid, subject):
self.subjects[room_jid] = subject self.subjects[room_jid] = subject
...@@ -428,8 +446,8 @@ class Groupchat_window(Chat): ...@@ -428,8 +446,8 @@ class Groupchat_window(Chat):
self.list_treeview[room_jid] = self.xmls[room_jid].\ self.list_treeview[room_jid] = self.xmls[room_jid].\
get_widget('list_treeview') get_widget('list_treeview')
#status_image, nickname, real_jid #status_image, nickname, real_jid, status
store = gtk.TreeStore(gtk.Image, str, str) store = gtk.TreeStore(gtk.Image, str, str, str)
column = gtk.TreeViewColumn('contacts') column = gtk.TreeViewColumn('contacts')
render_text = ImageCellRenderer() render_text = ImageCellRenderer()
column.pack_start(render_text, expand = False) column.pack_start(render_text, expand = False)
......
...@@ -371,15 +371,7 @@ class Roster_window: ...@@ -371,15 +371,7 @@ class Roster_window:
self.redraw_jid(user.jid, account) self.redraw_jid(user.jid, account)
#Print status in chat window #Print status in chat window
if self.plugin.windows[account]['chats'].has_key(user.jid): if self.plugin.windows[account]['chats'].has_key(user.jid):
prio = 0 self.plugin.windows[account]['chats'][user.jid].set_image(user.jid)
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)
name = user.name name = user.name
if user.resource != '': if user.resource != '':
name += '/'+user.resource name += '/'+user.resource
...@@ -1116,6 +1108,28 @@ class Roster_window: ...@@ -1116,6 +1108,28 @@ class Roster_window:
image.set_from_file(file) image.set_from_file(file)
break 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): def sound_is_ok(self, sound):
if not os.path.exists(sound): if not os.path.exists(sound):
return 0 return 0
......
...@@ -69,7 +69,15 @@ class Tabbed_chat_window(Chat): ...@@ -69,7 +69,15 @@ class Tabbed_chat_window(Chat):
if not user.keyID: if not user.keyID:
self.xmls[jid].get_widget('gpg_togglebutton').set_sensitive(False) 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: if image.get_storage_type() == gtk.IMAGE_ANIMATION:
self.xmls[jid].get_widget('status_image').\ self.xmls[jid].get_widget('status_image').\
set_from_animation(image.get_animation()) set_from_animation(image.get_animation())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment