summaryrefslogtreecommitdiff
path: root/src/Screensaver.vala
blob: c91462e7cfde420c838816f19bbb9a8bb6d9c5f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU LGPL (version 2.1 or later).
 * See the COPYING file in this distribution.
 */

public class Screensaver {
    private uint32 cookie = 0;
    
    public Screensaver() {
    }
    
    public void inhibit(string reason) {
        if (cookie != 0)
            return;

        cookie = Application.get_instance().inhibit(
            Gtk.ApplicationInhibitFlags.IDLE | Gtk.ApplicationInhibitFlags.SUSPEND, _("Slideshow"));
    }
    
    public void uninhibit() {
        if (cookie == 0)
            return;
        
        Application.get_instance().uninhibit(cookie);
        cookie = 0;
    }
}