Very basic details (name and hours) work now
This commit is contained in:
@@ -1,28 +1,21 @@
|
||||
module Wince
|
||||
@[Gtk::UiTemplate(resource: "/wince/ui/compiled/templates.ui", children: %w(businessName businessRating businessOpen businessDistance))]
|
||||
@[Gtk::UiTemplate(resource: "/wince/ui/compiled/templates.ui", children: %w(businessName businessRating businessDistance))]
|
||||
class BusinessRow < Gtk::ListBoxRow
|
||||
include Gtk::WidgetTemplate
|
||||
|
||||
@name : Gtk::Label
|
||||
@rating : Gtk::Label
|
||||
@open : Gtk::Label
|
||||
@distance : Gtk::Label
|
||||
|
||||
def initialize(name : String, rating : Float32, open : Bool, distance : Float32)
|
||||
def initialize(name : String, rating : Float32, distance : Float32)
|
||||
super()
|
||||
|
||||
@name = Gtk::Label.cast(template_child("businessName"))
|
||||
@rating = Gtk::Label.cast(template_child("businessRating"))
|
||||
@open = Gtk::Label.cast(template_child("businessOpen"))
|
||||
@distance = Gtk::Label.cast(template_child("businessDistance"))
|
||||
|
||||
@name.text = name
|
||||
@rating.text = rating.round(2).to_s
|
||||
if open
|
||||
@open.markup = "<span foreground=\"green\">open</span>"
|
||||
else
|
||||
@open.markup = "<span foreground=\"red\">closed</span>"
|
||||
end
|
||||
distance_miles = distance / 1609.344
|
||||
@distance.text = distance_miles.round(2).to_s + "mi"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user