change the cursor when it is on a mail or an url
This commit is contained in:
parent
3a7fd6f0f7
commit
0bae187b4c
2 changed files with 21 additions and 1 deletions
|
@ -8646,6 +8646,7 @@ Custom</property>
|
||||||
<property name="right_margin">0</property>
|
<property name="right_margin">0</property>
|
||||||
<property name="indent">0</property>
|
<property name="indent">0</property>
|
||||||
<property name="text" translatable="yes"></property>
|
<property name="text" translatable="yes"></property>
|
||||||
|
<signal name="motion_notify_event" handler="on_conversation_textview_motion_notify_event" last_modification_time="Thu, 10 Mar 2005 16:07:43 GMT"/>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -208,6 +208,7 @@ class tabbed_chat_window:
|
||||||
self.chat_notebook.remove_page(0)
|
self.chat_notebook.remove_page(0)
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.account = account
|
self.account = account
|
||||||
|
self.change_cursor = None
|
||||||
self.xmls = {}
|
self.xmls = {}
|
||||||
self.tagIn = {}
|
self.tagIn = {}
|
||||||
self.tagOut = {}
|
self.tagOut = {}
|
||||||
|
@ -602,6 +603,23 @@ class tabbed_chat_window:
|
||||||
self.show_title()
|
self.show_title()
|
||||||
self.plugin.systray.remove_jid(jid, self.account)
|
self.plugin.systray.remove_jid(jid, self.account)
|
||||||
|
|
||||||
|
def on_conversation_textview_motion_notify_event(self, widget, event):
|
||||||
|
"""change the cursor to a hand when we are on a mail or an url"""
|
||||||
|
x, y, spam = widget.window.get_pointer()
|
||||||
|
x, y = widget.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT, x, y)
|
||||||
|
tags = widget.get_iter_at_location(x, y).get_tags()
|
||||||
|
if self.change_cursor:
|
||||||
|
widget.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(None)
|
||||||
|
self.change_cursor = None
|
||||||
|
for tag in tags:
|
||||||
|
if tag == widget.get_buffer().get_tag_table().lookup('url') or \
|
||||||
|
tag == widget.get_buffer().get_tag_table().lookup('mail'):
|
||||||
|
widget.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(\
|
||||||
|
gtk.gdk.Cursor(gtk.gdk.HAND2))
|
||||||
|
self.change_cursor = tag
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def print_time_timeout(self, jid):
|
def print_time_timeout(self, jid):
|
||||||
if not jid in self.xmls.keys():
|
if not jid in self.xmls.keys():
|
||||||
return 0
|
return 0
|
||||||
|
@ -647,7 +665,8 @@ class tabbed_chat_window:
|
||||||
if text in self.plugin.emoticons.keys():
|
if text in self.plugin.emoticons.keys():
|
||||||
#it's a smiley
|
#it's a smiley
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
end_iter = conversation_buffer.get_end_iter()
|
||||||
conversation_buffer.insert_pixbuf(end_iter, self.plugin.emoticons[text])
|
conversation_buffer.insert_pixbuf(end_iter, \
|
||||||
|
self.plugin.emoticons[text])
|
||||||
return
|
return
|
||||||
elif text.startswith('mailto:'):
|
elif text.startswith('mailto:'):
|
||||||
#it's a mail
|
#it's a mail
|
||||||
|
|
Loading…
Add table
Reference in a new issue