Commit 4034efa7 authored by nkour's avatar nkour

we now have avatars in roster. I default to 48x48 (gaim defaults to that too)...

we now have avatars in roster. I default to 48x48 (gaim defaults to that too) u can change that to whatever you want via ACE and you can take avatars off via PREFS; defaulting to 32x32 is too small. njoy
parent a3cd40ac
......@@ -148,13 +148,16 @@ class Config:
'tabs_always_visible': [opt_bool, False, _('Show tab when only one conversation?')],
'tabs_border': [opt_bool, False, _('Show tab border if one conversation?')],
'tabs_close_button': [opt_bool, True, _('Show close button in tab?')],
'avatar_width': [opt_int, 52],
'avatar_height': [opt_int, 52],
'chat_avatar_width': [opt_int, 52],
'chat_avatar_height': [opt_int, 52],
'roster_avatar_width': [opt_int, 48],
'roster_avatar_height': [opt_int, 48],
'muc_highlight_words': [opt_str, '', _('A semicolon-separated list of words that will be highlighted in multi-user chat.')],
'quit_on_roster_x_button': [opt_bool, False, _('If True, quits Gajim when X button of Window Manager is clicked. This setting is taken into account only if trayicon is used.')],
'set_xmpp://_handler_everytime': [opt_bool, False, _('If True, Gajim registers for xmpp:// on each startup.')],
'show_unread_tab_icon': [opt_bool, False, _('If True, Gajim will display an icon on each tab containing unread messages. Depending on the theme, this icon may be animated.')],
'show_status_msgs_in_roster': [opt_bool, True, _('If True, Gajim will display the status message, if not empty, for every contact under the contact name in roster window')],
'show_avatars_in_roster': [opt_bool, True],
__options_per_key = {
......@@ -112,9 +112,14 @@ class PreferencesWindow:
st = gajim.config.get('sort_by_show')
# Display avatars in roster
st = gajim.config.get('show_avatars_in_roster')
# Display status msg under contact name in roster
st = gajim.config.get('show_status_msgs_in_roster')
#Use emoticons
st = gajim.config.get('useemoticons')
......@@ -482,6 +487,10 @@ class PreferencesWindow:
self.on_checkbutton_toggled(widget, 'show_status_msgs_in_roster')
def on_show_avatars_in_roster_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'show_avatars_in_roster')
def on_use_emoticons_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'useemoticons',
......@@ -3363,6 +3363,27 @@ Agent JID - node</property>
<widget class="GtkCheckButton" id="show_avatars_in_roster_checkbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">If checked, Gajim will display an avatar, if one is set, for every contact in roster window</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Display avatars of contacts in roster</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_show_avatars_in_roster_checkbutton_toggled" last_modification_time="Tue, 08 Nov 2005 12:52:11 GMT"/>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<widget class="GtkCheckButton" id="show_status_msgs_in_roster_checkbutton">
<property name="visible">True</property>
......@@ -398,3 +398,19 @@ def _get_fade_color(treeview, selected):
return gtk.gdk.Color(( +,
( +,
( +
def get_scaled_pixbuf(pixbuf, type):
'''returns scaled pixbuf, keeping ratio etc
type is either "chat" or "roster"'''
# resize to a width / height for the avatar not to have distortion
# (keep aspect ratio)
ratio = float(pixbuf.get_width()) / float(pixbuf.get_height())
if ratio > 1:
w = gajim.config.get(type + '_avatar_width')
h = int(w / ratio)
h = gajim.config.get(type + '_avatar_height')
w = int(h * ratio)
scaled_buf = pixbuf.scale_simple(w, h, gtk.gdk.INTERP_HYPER)
return scaled_buf
......@@ -183,8 +183,17 @@ class RosterWindow:
if g == _('Transports'):
typestr = 'agent'
if gajim.config.get('show_avatars_in_roster'):
pixbuf = gajim.interface.get_avatar_pixbuf_from_cache(jid)
if pixbuf in ('ask', None):
scaled_pixbuf = None
scaled_pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'roster')
scaled_pixbuf = None
model.append(iterG, [self.jabber_state_images[],,
typestr, user.jid, account, False, None]) # FIXME None --> avatar
typestr, user.jid, account, False, scaled_pixbuf])
if gajim.groups[account][g]['expand']:
self.tree.expand_row(model.get_path(iterG), False)
......@@ -298,7 +298,7 @@ class TabbedChatWindow(chat.Chat):
# we assume contact has no avatar
scaled_buf = None
scaled_pixbuf = None
real_jid = gajim.get_real_jid_from_fjid(self.account, jid)
pixbuf = None
......@@ -309,19 +309,11 @@ class TabbedChatWindow(chat.Chat):
if pixbuf is not None:
# resize to a width / height for the avatar not to have distortion
# (keep aspect ratio)
ratio = float(pixbuf.get_width()) / float(pixbuf.get_height())
if ratio > 1:
w = gajim.config.get('avatar_width')
h = int(w / ratio)
h = gajim.config.get('avatar_height')
w = int(h * ratio)
scaled_buf = pixbuf.scale_simple(w, h, gtk.gdk.INTERP_HYPER)
scaled_pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'chat')
image = xml.get_widget('avatar_image')
def set_state_image(self, jid):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment