# File gtk/sample/gtk-demo/images.rb, line 23
    def initialize
      @pixbuf_loader = nil
      @load_timeout = 0
      @image_stream = nil

      super('Images')
      signal_connect('destroy') do
        cleanup_callback
      end
      
      self.border_width = 8

      vbox = Gtk::VBox.new(false, 8)
      vbox.border_width = 8
      add(vbox)

      label = Gtk::Label.new
      label.set_markup('<u>Image loaded from a file</u>')
      vbox.pack_start(label, false, false, 0)
      
      frame = Gtk::Frame.new
      frame.shadow_type = Gtk::SHADOW_IN
      
      # The alignment keeps the frame from growing when users resize
      # the window
      align = Gtk::Alignment.new(0.5, 0.5, 0, 0)
      align.add(frame)
      vbox.pack_start(align, false, false, 0)

      # demo_find_file looks in the the current directory first,
      # so you can run gtk-demo without installing GTK, then looks
      # in the location where the file is installed.
      pixbuf = nil
      begin
        filename = Demo.find_file('gtk-logo-rgb.gif')
        pixbuf = Gdk::Pixbuf.new(filename)
      rescue
        # This code shows off error handling. You can just use
        # Gtk::Image.new instead if you don't want to report
        # errors to the user. If the file doesn't load when using
        # Gtk::Image.new, a 'missing image' icon will
        # be displayed instead.
        dialog = Gtk::MessageDialog.new(self,
                                        Gtk::Dialog::DESTROY_WITH_PARENT,
                                        Gtk::MessageDialog::ERROR,
                                        Gtk::MessageDialog::BUTTONS_CLOSE,
                                        "Unable to open image file 'gtk-logo-rgb.gif': #{$1}")
        
        dialog.signal_connect('response') do |widget, data|
          widget.destroy
        end
        dialog.show
      end
      
      image = Gtk::Image.new(pixbuf)
      frame.add(image)


      # Animation
      label = Gtk::Label.new
      label.set_markup('<u>Animation loaded from a file</u>')
      vbox.pack_start(label, false, false, 0)
      
      frame = Gtk::Frame.new
      frame.shadow_type = Gtk::SHADOW_IN
      
      # The alignment keeps the frame from growing when users resize
      # the window
      align = Gtk::Alignment.new(0.5, 0.5, 0, 0)
      align.add(frame)
      vbox.pack_start(align, false, false, 0)

      filename = Demo.find_file('floppybuddy.gif')
      image = Gtk::Image.new(filename)
      frame.add(image)
      

      # Progressive
      label = Gtk::Label.new
      label.set_markup('<u>Progressive image loading</u>')
      vbox.pack_start(label, false, false, 0)
      
      frame = Gtk::Frame.new(nil)
      frame.shadow_type = Gtk::SHADOW_IN
      
      # The alignment keeps the frame from growing when users resize
      # the window
      align = Gtk::Alignment.new(0.5, 0.5, 0, 0)
      align.add(frame)
      vbox.pack_start(align, false, false, 0)

      # Create an empty image for now; the progressive loader
      # will create the pixbuf and fill it in.
      image = Gtk::Image.new
      frame.add(image)

      start_progressive_loading(image)

      # Sensitivity control
      button = Gtk::ToggleButton.new('_Insensitive', true)
      vbox.pack_start(button, false, false, 0)

      button.signal_connect('toggled') do |widget|
        vbox.children.each do |widget|
          if widget != button
            widget.sensitive = ! button.active?
          end
        end
      end
    end