summaryrefslogtreecommitdiff
path: root/src/Screensaver.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/Screensaver.vala')
-rw-r--r--src/Screensaver.vala29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Screensaver.vala b/src/Screensaver.vala
new file mode 100644
index 0000000..d00af21
--- /dev/null
+++ b/src/Screensaver.vala
@@ -0,0 +1,29 @@
+/* Copyright 2009-2014 Yorba Foundation
+ *
+ * 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;
+ }
+}
+