Sha256: 3f0950b7c43979ffb5ddef2461baec4a9d2e8c788cb81f7ddf04696dc8e239d6

Contents?: true

Size: 801 Bytes

Versions: 1

Compression:

Stored size: 801 Bytes

Contents

require_relative '../tools'
require 'gtk3'

module ManabuDesktop
  module Screens
    class Base
      attr_accessor :window, :builder

      def initialize(layout, locale = :c)
        @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.signal_connect('delete-event') do |_widget|
          @window.destroy()
          Gtk.main_quit()
        end
      end

      def _show()
        @window.show()
        Gtk.main()
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
manabu-desktop-0.0.2 lib/screens/base.rb