class ManabuDesktop::Screens::Base
Attributes
builder[RW]
window[RW]
Public Class Methods
new(layout, locale = :c, opts = {})
click to toggle source
opts:
icon_path: path to an icon image for the window icon
# File lib/screens/base.rb, line 15 def initialize(layout, locale = :c, opts = {}) @builder = Gtk::Builder.new() @builder.add_from_file("#{__dir__}/../../layouts/#{layout}.glade") @builder.connect_signals do |handler| begin method(handler) rescue puts "#{handler} not yet implemented!" method('not_yet_implemented') end end @window = builder.get_object("#{layout}.Window") @window.set_title(I18n.t("#{layout}.title")) if opts.include? :icon_path begin @window.set_icon(opts[:icon_path]) rescue @window.set_icon("#{__dir__}/../../layouts/img/gaku-logo-128.png") end else @window.set_icon("#{__dir__}/../../layouts/img/gaku-logo-128.png") end unless @@gtk_main_quit_set @window.signal_connect('delete-event') do |_widget| #@window.destroy() ManabuDesktop::Windows.destroy_all() Gtk.main_quit() end @@gtk_main_quit_set = true end end
Public Instance Methods
_show()
click to toggle source
# File lib/screens/base.rb, line 49 def _show() @window.show() unless @@gtk_initialized Gtk.main() @@gtk_initialized = true end end