is this good code?
- From: "Dr. Michael J. Chudobiak" <mjc avtechpulse com>
- To: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: is this good code?
- Date: Wed, 18 Mar 2009 08:25:16 -0400
I've never fully understood the timing issues with signals and 
callbacks. Is this good or evil (vala) code?
public bool ensureConnected () {
    /* try to connect, if not already connected */
    if (!connectButton.get_active())
         connectButton.set_active(true);
    /* are we connected now? */
    return connectButton.get_active();
}
The last line is support to report back whether or not the preceding 
"set_active(true)" was successful. Some error in the code call by the 
set_active signal could have caused it to revert to the false state.
Anyway, I guess the question is: has all code tied to the 
set_active(true) signal executed before the last line?
- Mike
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]