Re: [Vala] problem using sleep



a a wrote:
I want to stop the timeout by pressing a button.
What code stopes it?

Thanks.

int time_min = 5;

var timeout = Timeout.add (time_min * 1000 * 60, () => {
        try {
                Process.spawn_command_line_async ("gksudo '/etc/acpi/hibernate.sh'");
        } catch (Error e) {
                stderr.printf ("%s\n", e.message);
        }
        return false;
});

var button = new Button.with_label ("Stop!");
button.clicked.connect (() => Source.remove (timeout));



Best regards,

Frederik



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]