Sha256: 68d43cc38d86903533e4c2face8cb5d94832f58c507c2ab0d3028177488b4ded

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

module Gtk3App
  using Rafini::String
  using Rafini::Hash
  using Rafini::Exception

  def self.config(mod)
    # Let's get NameErrors out of the way first
    appdir  = mod::APPDIR
    config  = mod::CONFIG
    version = mod::VERSION
    # Create the directory name for UserSpace.
    appname = mod.name.downcase
    appname.prepend('gtk3app/') unless mod==Gtk3App
    # UserSpace does its thing...
    user_space = UserSpace.new(
      YAML,
      ext: 'yml',
      config: "config-#{version.semantic(0..1)}",
      appname: appname,
      appdir: appdir
    )
    user_space.install unless user_space.version == version
    user_space.configures(config)
  rescue NameError
    $!.puts 'Application is not using APPDIR, VERSION, or CONFIG.'
  end

  def self.init(mod)
    Gtk3App.config mod
    if thing = mod::CONFIG[:thing]
      Such::Thing.configure thing
    end
  rescue NameError
    $!.puts 'Application is not using CONFIG.'
  end

  def self.main(app)
    Gtk3App.init Gtk3App
    Gtk3App.init app
    @program = Program.new app
    Gtk.main
  rescue StandardError
    $!.puts
    exit 1
  ensure
    @program.release if @program
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gtk3app-2.1.1 lib/gtk3app/gtk3app.rb
gtk3app-2.1.0 lib/gtk3app/gtk3app.rb
gtk3app-2.0.2 lib/gtk3app/gtk3app.rb
gtk3app-2.0.1 lib/gtk3app/gtk3app.rb