diff --git a/src/chat.py b/src/chat.py index a543a09ae11a7f61da89084cb11c355b77131b3c..5a0e2450318ec719c10370739c6db2ef18e9bbd9 100644 --- a/src/chat.py +++ b/src/chat.py @@ -612,22 +612,27 @@ class Chat: index = end # update index #now print it - self.print_special_text(special_text, other_tags, - buffer) + self.print_special_text(special_text, other_tags, textview) return index - def print_special_text(self, special_text, other_tags, buffer): + def print_special_text(self, special_text, other_tags, textview): tags = [] use_other_tags = True + buffer = textview.get_buffer() possible_emot_ascii_caps = special_text.upper() # emoticons keys are CAPS if possible_emot_ascii_caps in self.plugin.emoticons.keys(): #it's an emoticon emot_ascii = possible_emot_ascii_caps end_iter = buffer.get_end_iter() - buffer.insert_pixbuf(end_iter, - self.plugin.emoticons[emot_ascii]) + anchor = buffer.create_child_anchor(end_iter) + w = gtk.Image() + w.set_from_file(self.plugin.emoticons[emot_ascii]) + w.show() + textview.add_child_at_anchor(w, anchor) +# buffer.insert_pixbuf(end_iter, +# self.plugin.emoticons[emot_ascii]) elif special_text.startswith('mailto:'): #it's a mail tags.append('mail') diff --git a/src/config.py b/src/config.py index 9877684a29592ebbe0556b637f6070aa7479bcb3..2ecbc7428e3c99945e6c231afd1f7deb94a1242a 100644 --- a/src/config.py +++ b/src/config.py @@ -1691,9 +1691,13 @@ class ManageEmoticonsWindow: img.set_from_file(image) except: return False - if img.get_storage_type() != gtk.IMAGE_PIXBUF: + t = img.get_storage_type() + if t == gtk.IMAGE_PIXBUF: + pix = img.get_pixbuf() + elif t == gtk.IMAGE_ANIMATION: + pix = img.get_animation().get_static_image() + else: return False - pix = img.get_pixbuf() if pix.get_width() > 24 or pix.get_height() > 24: dialogs.ErrorDialog(_('Image is too big'), _('Image for emoticon has to be less than or equal to 24 pixels in width and 24 in height.')).get_response() diff --git a/src/gajim.py b/src/gajim.py index 75b56e210034ec4b7d9a39483d4f285f460ceedb..6c8d322a10f744629a5c540a6d3f2d411b8c3930 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -664,9 +664,8 @@ class Interface: img.set_from_file(image) except: return False - if img.get_storage_type() == gtk.IMAGE_PIXBUF: - pix = img.get_pixbuf() - else: + t = img.get_storage_type() + if t != gtk.IMAGE_PIXBUF and t != gtk.IMAGE_ANIMATION: return False return True @@ -727,8 +726,9 @@ class Interface: emot_file = gajim.config.get_per('emoticons', emot, 'path') if not self.image_is_ok(emot_file): continue - pix = gtk.gdk.pixbuf_new_from_file(emot_file) - self.emoticons[emot] = pix + img = gtk.Image() + img.set_from_file(emot_file) + self.emoticons[emot] = emot_file # update regular expressions self.make_regexps()