[Vala] returning async func from a callback
- From: MohanR <mohan43u gmail com>
- To: vala-list gnome org
- Subject: [Vala] returning async func from a callback
- Date: Tue, 27 Jan 2015 03:38:19 +0800
Hi,
I'm not able to find a way to finish a async function from a signal's
lambda callback, something like this,
public async bool init(string[] args) {
Gtk.init_check(ref args);
/* do some gtk and webkit setup stuff */
window.delete_event.connect((event) => {
if(this.access_token == null) {
/* user closed the window
* without providing authorization.
* so, trying to return the "init"
* instead, below return applied
* to the "delete_event" callback,
* not to the async "init" func.
*/
return false; //failed
}
});
webview.load_changed.connect((event)=> {
if(event == WebKit.LoadEvent.REDIRECTED) {
/*get "code" and do
* some other stuff
*/
}
})
}
I'm new to vala, so experts help needed. In IRC, I got suggestion to use
"Cancellable" and do "Cancellable.cancel()" to interrupt the async flow,
but I'm trying to find a better way because people don't care about
providing a cancellable object most of the time.
Thanks,
Mohan R
Thanks,
Mohan R
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]