Changeset 8934

Show
Ignore:
Timestamp:
11/05/07 06:52:50 (13 months ago)
Author:
asterix
Message:

[misc] remove duplicate function. fixes #3524

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/profile_window.py

    r8927 r8934  
    2929import gtkgui_helpers 
    3030import dialogs 
     31import vcard 
    3132 
    3233from common import gajim 
    3334from common.i18n import Q_ 
    3435 
    35 def get_avatar_pixbuf_encoded_mime(photo): 
    36         '''return the pixbuf of the image 
    37         photo is a dictionary containing PHOTO information''' 
    38         if not isinstance(photo, dict): 
    39                 return None, None, None 
    40         img_decoded = None 
    41         avatar_encoded = None 
    42         avatar_mime_type = None 
    43         if photo.has_key('BINVAL'): 
    44                 img_encoded = photo['BINVAL'] 
    45                 avatar_encoded = img_encoded 
    46                 try: 
    47                         img_decoded = base64.decodestring(img_encoded) 
    48                 except: 
    49                         pass 
    50         if img_decoded: 
    51                 if photo.has_key('TYPE'): 
    52                         avatar_mime_type = photo['TYPE'] 
    53                         pixbuf = gtkgui_helpers.get_pixbuf_from_data(img_decoded) 
    54                 else: 
    55                         pixbuf, avatar_mime_type = gtkgui_helpers.get_pixbuf_from_data( 
    56                                                         img_decoded, want_type=True) 
    57         else: 
    58                 pixbuf = None 
    59         return pixbuf, avatar_encoded, avatar_mime_type 
    6036 
    6137class ProfileWindow: 
     
    229205                        if i == 'PHOTO': 
    230206                                pixbuf, self.avatar_encoded, self.avatar_mime_type = \ 
    231                                         get_avatar_pixbuf_encoded_mime(vcard[i]) 
     207                                        vcard.get_avatar_pixbuf_encoded_mime(vcard[i]) 
    232208                                if not pixbuf: 
    233209                                        image.set_from_pixbuf(None)