class BuilderDemo

# Copyright © 2015-2016 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. #

Builder

Demonstrates an interface loaded from a XML description.

Public Class Methods

new(_main_window) click to toggle source
# File gtk3/sample/gtk-demo/builder.rb, line 10
def initialize(_main_window)
  @builder = Gtk::Builder.new(:resource => "/builder/demo.ui")
  @builder.connect_signals {}

  @window = @builder["window1"]
  toolbar = @builder["toolbar1"]
  toolbar.style_context.add_class("primary-toolbar")


  add_actions
  add_accelerators
end

Public Instance Methods

run() click to toggle source
# File gtk3/sample/gtk-demo/builder.rb, line 23
def run
  if !@window.visible?
    @window.show_all
  else
    @window.destroy
  end
  @window
end