[misc] remove duplicate function. fixes #3524

This commit is contained in:
Yann Leboulanger 2007-11-05 05:52:50 +00:00
parent c15b616ddd
commit 57c3221d90
1 changed files with 2 additions and 26 deletions

View File

@ -28,35 +28,11 @@ import os
import gtkgui_helpers
import dialogs
import vcard
from common import gajim
from common.i18n import Q_
def get_avatar_pixbuf_encoded_mime(photo):
'''return the pixbuf of the image
photo is a dictionary containing PHOTO information'''
if not isinstance(photo, dict):
return None, None, None
img_decoded = None
avatar_encoded = None
avatar_mime_type = None
if photo.has_key('BINVAL'):
img_encoded = photo['BINVAL']
avatar_encoded = img_encoded
try:
img_decoded = base64.decodestring(img_encoded)
except:
pass
if img_decoded:
if photo.has_key('TYPE'):
avatar_mime_type = photo['TYPE']
pixbuf = gtkgui_helpers.get_pixbuf_from_data(img_decoded)
else:
pixbuf, avatar_mime_type = gtkgui_helpers.get_pixbuf_from_data(
img_decoded, want_type=True)
else:
pixbuf = None
return pixbuf, avatar_encoded, avatar_mime_type
class ProfileWindow:
'''Class for our information window'''
@ -228,7 +204,7 @@ class ProfileWindow:
for i in vcard.keys():
if i == 'PHOTO':
pixbuf, self.avatar_encoded, self.avatar_mime_type = \
get_avatar_pixbuf_encoded_mime(vcard[i])
vcard.get_avatar_pixbuf_encoded_mime(vcard[i])
if not pixbuf:
image.set_from_pixbuf(None)
button.hide()