Created
September 24, 2011 06:25
-
-
Save cosmo0920/1239036 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tag_user_id_link(body) | |
tag = body.buffer.create_tag('_user_id_link', | |
'foreground' => 'blue', | |
"underline" => Pango::UNDERLINE_SINGLE) | |
tag.signal_connect('event'){ |this, textview, event, iter| | |
result = false | |
if(event.is_a?(Gdk::EventButton)) and | |
(event.event_type == Gdk::Event::BUTTON_RELEASE) and | |
not(textview.buffer.selection_bounds[2]) | |
if (event.button == 1) | |
#'http://twitter.com/'+user[:idname]->'http://twitter.com/#!/'+user[:idname]へ変更 | |
Gtk::openurl('http://twitter.com/#!/'+user[:idname]) end | |
elsif(event.is_a?(Gdk::EventMotion)) | |
body.set_cursor(textview, Gdk::Cursor::HAND2) end | |
result } | |
tag end } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment