Screensaver.vala 698 Bytes
Newer Older
1
/* Copyright 2016 Software Freedom Conservancy Inc.
2 3
 *
 * This software is licensed under the GNU LGPL (version 2.1 or later).
4
 * See the COPYING file in this distribution.
5 6 7 8
 */

public class Screensaver {
    private uint32 cookie = 0;
9
    
10 11 12 13
    public Screensaver() {
    }
    
    public void inhibit(string reason) {
14
        if (cookie != 0)
15
            return;
16 17 18

        cookie = Application.get_instance().inhibit(
            Gtk.ApplicationInhibitFlags.IDLE | Gtk.ApplicationInhibitFlags.SUSPEND, _("Slideshow"));
19 20 21
    }
    
    public void uninhibit() {
22
        if (cookie == 0)
23
            return;
24
        
25
        Application.get_instance().uninhibit(cookie);
26 27 28
        cookie = 0;
    }
}
29