Sha256: 8d2e5e586747812f81667a91d4e8af05ef5961088fef890ac43313438d740fab

Contents?: true

Size: 1.21 KB

Versions: 19

Compression:

Stored size: 1.21 KB

Contents

# Copyright (c) 2015-2016 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
=begin
= Revealer

GtkRevealer is a container that animates showing and hiding
of its sole child with nice transitions.
=end
class RevealerDemo
  def initialize(main_window)
    @builder = Gtk::Builder.new(:resource => "/revealer/revealer.ui")
    @builder.connect_signals {}

    @timeout = nil
    @count = 0

    @window = @builder["window"]
    @window.screen = main_window.screen
    @window.signal_connect "destroy" do
      if @timeout
        GLib::Source.remove(@timeout)
        @timeout = nil
      end
    end
  end

  def run
    if !@window.visible?
      add_timeout
      @window.show_all
    else
      @window.destroy
    end
    @window
  end

  private

  def add_timeout
    @timeout = GLib::Timeout.add(690) do
      name = "revealer#{@count}"

      revealer = @builder[name]
      revealer.reveal_child = true

      revealer.signal_connect "notify::child-revealed" do |widget|
        revealed = widget.child_revealed?
        widget.reveal_child = revealed
      end

      @count += 1
      if @count >= 9
        @timeout = nil
        false
      else
        true
      end
    end
  end
end

Version data entries

19 entries across 11 versions & 2 rubygems

Version Path
savant-echo-1.0.4 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-1.0.4 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-1.0.1 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-1.0.1 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-0.1.91 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-0.1.91 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-0.1.9 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-0.1.9 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-0.1.6 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-0.1.6 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-0.1.5 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-0.1.5 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-0.1.4 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-0.1.4 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-0.1.3 bin/alexa-0.1.2-osx/lib/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
savant-echo-0.1.3 bin/packaging/vendor/ruby/2.2.0/gems/gtk3-3.1.0/sample/gtk-demo/revealer.rb
gtk3-3.1.0-x64-mingw32 sample/gtk-demo/revealer.rb
gtk3-3.1.0-x86-mingw32 sample/gtk-demo/revealer.rb
gtk3-3.1.0 sample/gtk-demo/revealer.rb