org.gnu.glib

Class CustomEvents

public final class CustomEvents extends GObject

Provides methods for adding custom event sources. The main glib thread will poll this ojbect as part of its main loop. If any events are pending, they will be executed from within the main glib loop.

For multithreaded Gtk/Gnome applications, all gui modifications must be done from within the main loop. The methods of this class allow you to do this.

As events run on the main glib loop, only short methods should be executed in it.

Method Summary
static voidaddEvent(Runnable target)
Adds a new event to the queue.
static voidaddEventAndWait(Runnable target)
Adds a new event to the queue.
static voidrunEvents()
Executes the pending events.

Method Detail

addEvent

public static void addEvent(Runnable target)
Adds a new event to the queue. target.run() will be called in the next iteration of the glib (gtk) main loop. This method will return immediately after adding the item to the queue.

addEventAndWait

public static void addEventAndWait(Runnable target)
Adds a new event to the queue. target.run() will be called in the next iteration of the glib (gtk) main loop. This method waits until the method call has completed before returning.

runEvents

public static final void runEvents()
Executes the pending events. This is called from within the gtk main thread.