Commit 57c3221d authored by Yann Leboulanger's avatar Yann Leboulanger

[misc] remove duplicate function. fixes #3524

parent c15b616d
......@@ -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()
......
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