Reputation: 1087
I have a server listening for messages on a port running in a different thread. Now once it receives a message I need it to be displayed in a textbox.
Is there method like runOnUiThread() (which is in android) or equivalent in Vala, GTK?
Or else what are the alternatives?
Upvotes: 2
Views: 289
Reputation: 7153
Use GLib.Idle.add to schedule something in the event dispatch thread:
Idle.add(() => {
textbox.Entry = "foo";
return Source.REMOVE;
});
Upvotes: 4
Reputation: 1087
In contrast to many other Operating Systems, apparently you could perform UI operations from a non UI thread. I could successfully change the text of an Entry
from the server thread. Not sure if this is recommended though.
Upvotes: -1