Class: MittensUi::WebLink
Overview
A clickable hyperlink widget that opens a URL in the user’s default browser. Wraps Gtk::LinkButton.
Instance Attribute Summary collapse
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from Core
Instance Method Summary collapse
-
#initialize(name, url, options = {}) ⇒ WebLink
constructor
Creates a new WebLink widget.
-
#open_url ⇒ void
Opens the set @url link in a web browser.
Methods inherited from Core
#hidden?, #hide, #keyboard_shortcut, #remove, #remove_keyboard_shortcut, #render, #shortcuts, #show
Methods included from Helpers
#icon_map, #list_system_icons, #set_margin_from_opts_for
Constructor Details
#initialize(name, url, options = {}) ⇒ WebLink
Creates a new WebLink widget.
40 41 42 43 44 45 |
# File 'lib/mittens_ui/web_link.rb', line 40 def initialize(name, url, = {}) @name = name || '' @url = url || '' @web_link = Gtk::LinkButton.new(@url, @name) super(@web_link, ) end |
Instance Attribute Details
#url ⇒ Object
Returns the value of attribute url.
33 34 35 |
# File 'lib/mittens_ui/web_link.rb', line 33 def url @url end |
Instance Method Details
#open_url ⇒ void
This method returns an undefined value.
Opens the set @url link in a web browser.
50 51 52 53 |
# File 'lib/mittens_ui/web_link.rb', line 50 def open_url launcher = Gtk::UriLauncher.new(@url) launcher.launch end |