diff --git a/src/config.py b/src/config.py index dfd6a9615..16f7c1daf 100644 --- a/src/config.py +++ b/src/config.py @@ -1975,7 +1975,13 @@ class ManageEmoticonsWindow: def update_preview(self, widget): path_to_file = widget.get_preview_filename() - widget.get_preview_widget().set_from_file(path_to_file) + if os.path.isdir(path_to_file): + return + try: + pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(path_to_file, 32, 32) + except (gobject.GError, TypeError): + return + widget.get_preview_widget().set_from_pixbuf(pixbuf) def on_set_image_button_clicked(self, widget, data=None): (model, iter) = self.emot_tree.get_selection().get_selected() diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py index 5fbb8a7cd..86f4b69d5 100644 --- a/src/tabbed_chat_window.py +++ b/src/tabbed_chat_window.py @@ -206,7 +206,7 @@ timestamp, contact): pixbufloader.write(img_decoded) pixbuf = pixbufloader.get_pixbuf() pixbufloader.close() - + w = gajim.config.get('avatar_width') h = gajim.config.get('avatar_height') scaled_buf = pixbuf.scale_simple(w, h, gtk.gdk.INTERP_HYPER) diff --git a/src/vcard.py b/src/vcard.py index b3bfb72b7..1fb3ae07a 100644 --- a/src/vcard.py +++ b/src/vcard.py @@ -19,6 +19,7 @@ import gtk import gtk.glade +import gobject import urllib import base64 import mimetypes @@ -120,7 +121,12 @@ class VcardWindow: def update_preview(self, widget): path_to_file = widget.get_preview_filename() - pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(path_to_file, 100, 100) + if os.path.isdir(path_to_file): + return + try: + pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(path_to_file, 100, 100) + except gobject.GError: + return widget.get_preview_widget().set_from_pixbuf(pixbuf) def on_set_avatar_button_clicked(self, widget):