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

This commit is contained in:
Nikos Kouremenos 2005-11-08 13:04:59 +00:00
parent a3cd40ac84
commit 4034efa762
6 changed files with 65 additions and 15 deletions

View File

@ -148,13 +148,16 @@ class Config:
'tabs_always_visible': [opt_bool, False, _('Show tab when only one conversation?')], 'tabs_always_visible': [opt_bool, False, _('Show tab when only one conversation?')],
'tabs_border': [opt_bool, False, _('Show tab border if one conversation?')], 'tabs_border': [opt_bool, False, _('Show tab border if one conversation?')],
'tabs_close_button': [opt_bool, True, _('Show close button in tab?')], 'tabs_close_button': [opt_bool, True, _('Show close button in tab?')],
'avatar_width': [opt_int, 52], 'chat_avatar_width': [opt_int, 52],
'avatar_height': [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.')], '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.')], '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.')], '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_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_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 = { __options_per_key = {

View File

@ -112,9 +112,14 @@ class PreferencesWindow:
st = gajim.config.get('sort_by_show') st = gajim.config.get('sort_by_show')
self.xml.get_widget('sort_by_show_checkbutton').set_active(st) self.xml.get_widget('sort_by_show_checkbutton').set_active(st)
# Display avatars in roster
st = gajim.config.get('show_avatars_in_roster')
self.xml.get_widget('show_avatars_in_roster_checkbutton').set_active(st)
# Display status msg under contact name in roster # Display status msg under contact name in roster
st = gajim.config.get('show_status_msgs_in_roster') st = gajim.config.get('show_status_msgs_in_roster')
self.xml.get_widget('show_status_msgs_in_roster_checkbutton').set_active(st) self.xml.get_widget('show_status_msgs_in_roster_checkbutton').set_active(st)
#Use emoticons #Use emoticons
st = gajim.config.get('useemoticons') st = gajim.config.get('useemoticons')
@ -482,6 +487,10 @@ class PreferencesWindow:
self.on_checkbutton_toggled(widget, 'show_status_msgs_in_roster') self.on_checkbutton_toggled(widget, 'show_status_msgs_in_roster')
gajim.interface.roster.draw_roster() gajim.interface.roster.draw_roster()
def on_show_avatars_in_roster_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'show_avatars_in_roster')
gajim.interface.roster.draw_roster()
def on_use_emoticons_checkbutton_toggled(self, widget): def on_use_emoticons_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'useemoticons', self.on_checkbutton_toggled(widget, 'useemoticons',
[self.xml.get_widget('add_remove_emoticons_button')]) [self.xml.get_widget('add_remove_emoticons_button')])

View File

@ -3363,6 +3363,27 @@ Agent JID - node</property>
</packing> </packing>
</child> </child>
<child>
<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"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child> <child>
<widget class="GtkCheckButton" id="show_status_msgs_in_roster_checkbutton"> <widget class="GtkCheckButton" id="show_status_msgs_in_roster_checkbutton">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -398,3 +398,19 @@ def _get_fade_color(treeview, selected):
return gtk.gdk.Color((bg.red + fg.red)/2, return gtk.gdk.Color((bg.red + fg.red)/2,
(bg.green + fg.green)/2, (bg.green + fg.green)/2,
(bg.blue + fg.blue)/2) (bg.blue + fg.blue)/2)
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)
else:
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

View File

@ -183,8 +183,17 @@ class RosterWindow:
if g == _('Transports'): if g == _('Transports'):
typestr = 'agent' 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
else:
scaled_pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'roster')
else:
scaled_pixbuf = None
model.append(iterG, [self.jabber_state_images[user.show], user.name, model.append(iterG, [self.jabber_state_images[user.show], user.name,
typestr, user.jid, account, False, None]) # FIXME None --> avatar typestr, user.jid, account, False, scaled_pixbuf])
if gajim.groups[account][g]['expand']: if gajim.groups[account][g]['expand']:
self.tree.expand_row(model.get_path(iterG), False) self.tree.expand_row(model.get_path(iterG), False)

View File

@ -298,7 +298,7 @@ class TabbedChatWindow(chat.Chat):
return return
# we assume contact has no avatar # we assume contact has no avatar
scaled_buf = None scaled_pixbuf = None
real_jid = gajim.get_real_jid_from_fjid(self.account, jid) real_jid = gajim.get_real_jid_from_fjid(self.account, jid)
pixbuf = None pixbuf = None
@ -309,19 +309,11 @@ class TabbedChatWindow(chat.Chat):
gajim.connections[self.account].request_vcard(jid_with_resource) gajim.connections[self.account].request_vcard(jid_with_resource)
return return
if pixbuf is not None: if pixbuf is not None:
# resize to a width / height for the avatar not to have distortion scaled_pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'chat')
# (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)
else:
h = gajim.config.get('avatar_height')
w = int(h * ratio)
scaled_buf = pixbuf.scale_simple(w, h, gtk.gdk.INTERP_HYPER)
image = xml.get_widget('avatar_image') image = xml.get_widget('avatar_image')
image.set_from_pixbuf(scaled_buf) image.set_from_pixbuf(scaled_pixbuf)
image.show_all() image.show_all()
def set_state_image(self, jid): def set_state_image(self, jid):