lib/alexandria/ui/iconview_tooltips.rb in alexandria-book-collection-manager-0.7.3 vs lib/alexandria/ui/iconview_tooltips.rb in alexandria-book-collection-manager-0.7.4
- old
+ new
@@ -27,22 +27,22 @@
# from the "php-gtk2 Cookbook" website, by kksou.
# http://www.kksou.com/php-gtk2/articles/display-tooltips-in-GtkTreeView---Part-3---no-hardcoding-of-header-height.php
#
# Ported to ruby-gtk2 (and modified for IconView) by Cathal Mc Ginley
-require 'cgi'
+require "cgi"
class IconViewTooltips
include Alexandria::Logging
def initialize(view)
set_view(view)
end
def set_view(view)
view.has_tooltip = true
- view.signal_connect('query-tooltip') do |_widget, x, y, _keyboard_mode, tooltip|
+ view.signal_connect("query-tooltip") do |_widget, x, y, _keyboard_mode, tooltip|
tree_path = view.get_path_at_pos(x, y)
if tree_path
iter = view.model.get_iter(tree_path)
title = iter[2] # HACK: hardcoded, should use column names...
@@ -54,24 +54,24 @@
end
end
def label_for_book(title, authors, publisher, year)
# This is much too complex... but it works for now!
- html = ''
+ html = ""
unless title.empty?
html += "<b>#{CGI.escapeHTML(title)}</b>"
html += "\n" unless authors.empty?
end
html += "<i>#{CGI.escapeHTML(authors)}</i>" unless authors.empty?
html += "\n" if !title.empty? || !authors.empty?
- html += '<small>'
+ html += "<small>"
html += CGI.escapeHTML(publisher).to_s if publisher && !publisher.empty?
if year && !year.empty?
- html += ' ' if publisher && !publisher.empty?
+ html += " " if publisher && !publisher.empty?
html += "(#{year})"
end
- html + '</small>'
+ html + "</small>"
end
end