diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade index 5f65f3b40e8c3c7cf992f6aa13e9dfe07d2ee54f..40c7c184674478ce4e57d9785a84a9dbdea952e4 100644 --- a/plugins/gtkgui/gtkgui.glade +++ b/plugins/gtkgui/gtkgui.glade @@ -8646,6 +8646,7 @@ Custom</property> <property name="right_margin">0</property> <property name="indent">0</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> </child> </widget> diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index 48eedd5f5df0d7b3f2626d8b86ed3ad243c0f721..5aea78217e61bfd19720156118da279630233ec8 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -208,6 +208,7 @@ class tabbed_chat_window: self.chat_notebook.remove_page(0) self.plugin = plugin self.account = account + self.change_cursor = None self.xmls = {} self.tagIn = {} self.tagOut = {} @@ -602,6 +603,23 @@ class tabbed_chat_window: self.show_title() 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): if not jid in self.xmls.keys(): return 0 @@ -647,7 +665,8 @@ class tabbed_chat_window: if text in self.plugin.emoticons.keys(): #it's a smiley 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 elif text.startswith('mailto:'): #it's a mail