Hi,

On Apr 11, 2005 4:19 AM, Michael Gebhart <mail / miketech.net> wrote:

> I am programming an application with ruby-gnome. My application is
> downloading some data and I wanna display a download-dialog, while the
> downloading is running. So I created a GUI, the download-dialog. This
> dialog should be displayed, when the download begins. A progressbar shows
> the current download-state. Now my problem is, that the GUI is not really
> refreshed. At my first try the download-dialog became displayed, when the

(you should use ruby-gnome2-devel-en mailing-list)

Ruby threads, being entirely in the interpreter, are in my opinion a
particularly elegant solution for the problem of refreshing a gtk2
application performing intensive tasks (gtk will never even see that
multiple "threads" are executing). Check the following short example.

-=-=-=---=-=-=---=-=-=---=-=-=---=-=-=---=-=-=--
require 'gtk2'

Gtk.init

v = Gtk::VBox.new
v.add(l = Gtk::Label.new('ready'))
v.add(b = Gtk::Button.new('start'))
w = Gtk::Window.new.add(v).show_all

b.signal_connect('clicked') {
    Thread.new {
        1.upto(4) { |i|
            l.label = "downloading part #{i}"
            sleep 2
        }
        l.label = 'ready'
    }
}

Gtk.main
-=-=-=---=-=-=---=-=-=---=-=-=---=-=-=---=-=-=--

-- 
Guillaume Cottenceau - http://zarb.org/~gc/