Skip to content
Snippets Groups Projects
Commit dbc1e6f7 authored by Thilo Molitor's avatar Thilo Molitor
Browse files

and some more small bugfixes

parent 29164093
No related branches found
No related tags found
No related merge requests found
[info]
name: Url image preview
short_name: url_image_preview
version: 0.7.2
version: 0.7.3
description: Url image preview in chatbox.<br/>
Based on patch in <a href="http://trac.gajim.org/attachment/ticket/5300">ticket #5300</a>.
authors = Denis Fomin <fominde@gmail.com>
......
......@@ -207,19 +207,20 @@ class Base(object):
eb.connect('leave-notify-event', self.on_leave_event)
# this is threadsafe (gtk textview is NOT threadsafe by itself!!)
def add_to_textview():
buffer_ = repl_start.get_buffer()
if buffer is None: # textview closed in the mean time etc.
return False
iter_ = buffer_.get_iter_at_mark(repl_start)
buffer_.insert(iter_, "\n")
anchor = buffer_.create_child_anchor(iter_)
# Use url as tooltip for image
img = TextViewImage(anchor, url)
img.set_from_pixbuf(pixbuf)
eb.add(img)
eb.show_all()
self.textview.tv.add_child_at_anchor(eb, anchor)
buffer_.delete(iter_, buffer_.get_iter_at_mark(repl_end))
try: # textview closed in the meantime etc.
buffer_ = repl_start.get_buffer()
iter_ = buffer_.get_iter_at_mark(repl_start)
buffer_.insert(iter_, "\n")
anchor = buffer_.create_child_anchor(iter_)
# Use url as tooltip for image
img = TextViewImage(anchor, url)
img.set_from_pixbuf(pixbuf)
eb.add(img)
eb.show_all()
self.textview.tv.add_child_at_anchor(eb, anchor)
buffer_.delete(iter_, buffer_.get_iter_at_mark(repl_end))
except:
pass
return False
gobject.idle_add(add_to_textview)
except Exception:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment