class InfobarDemo

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

Info Bars

Info bar widgets are used to report important messages to the user.

Public Class Methods

new(main_window) click to toggle source
# File gtk3/sample/gtk-demo/infobar.rb, line 10
def initialize(main_window)
  @actions = Gtk::Box.new(:horizontal, 0)

  @window = Gtk::Window.new(:toplevel)
  @window.screen = main_window.screen
  @window.set_title("Info Bars")
  @window.margin = 8

  @vbox = Gtk::Box.new(:vertical, 0)
  @window.add(@vbox)

  generate_simple_infobar("info")
  generate_simple_infobar("warning")

  generate_infobar_with_dialog

  generate_simple_infobar("error")
  generate_simple_infobar("other")

  frame = Gtk::Frame.new("Info bars")
  @vbox.pack_start(frame, :expand => false, :fill => false, :padding => 0)
  frame.margin_top = 8
  frame.margin_bottom = 8

  vbox2 = Gtk::Box.new(:vertical, 8)
  vbox2.margin = 8
  frame.add(vbox2)

  label = Gtk::Label.new("An example of different info bars")
  vbox2.pack_start(label, :expand => false, :fill => false, :padding => 0)
  @actions.show_all
  vbox2.pack_start(@actions, :expand => false, :fill => false, :padding => 0)
end

Public Instance Methods

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