diff --git a/src/gtkgui.glade b/src/gtkgui.glade index a0438f327..42d8f387c 100644 --- a/src/gtkgui.glade +++ b/src/gtkgui.glade @@ -4775,7 +4775,7 @@ True * False - + 0 @@ -8012,33 +8012,89 @@ Custom - + True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT + False + 0 - - 6 + True True - False - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - False - 0 - 0 - 0 - 0 - 0 - 0 - + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + 6 + True + True + False + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_WORD + False + 0 + 0 + 0 + 0 + 0 + 0 + + + + + 0 + True + True + + + + + + True + True + True + 0 + + + + True + 0.5 + 0.5 + 0 + 0 + + + + + + True + Photo + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 0 + True + True + diff --git a/src/vcard.py b/src/vcard.py index b087cac5b..a5d7a52a1 100644 --- a/src/vcard.py +++ b/src/vcard.py @@ -19,6 +19,8 @@ import gtk import gtk.glade +import urllib +import base64 from common import gajim from common import i18n _ = i18n._ @@ -76,6 +78,29 @@ class Vcard_window: def set_values(self, vcard): for i in vcard.keys(): if type(vcard[i]) == type({}): + if i == 'PHOTO': + img_decoded = None + if vcard[i].has_key('BINVAL'): + try: + img_encoded = vcard[i]['BINVAL'] + img_decoded = base64.decodestring(img_encoded) + except: + pass + elif vcard[i].has_key('EXTVAL'): + url = vcard[i]['EXTVAL'] + try: + fd = urllib.urlopen(url) + img_decoded = fd.read() + except: + pass + if img_decoded: + pixbufloader = gtk.gdk.PixbufLoader() + pixbufloader.write(img_decoded) + pixbufloader.close() + pixbuf = pixbufloader.get_pixbuf() + image = self.xml.get_widget('PHOTO_image') + image.set_from_pixbuf(pixbuf) + continue add_on = '' if i == 'ADR' or i == 'TEL' or i == 'EMAIL': add_on = '_HOME'