summaryrefslogtreecommitdiff
path: root/src/Screensaver.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 09:06:59 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 09:06:59 +0200
commit4ea2cc3bd4a7d9b1c54a9d33e6a1cf82e7c8c21d (patch)
treed2e54377d14d604356c86862a326f64ae64dadd6 /src/Screensaver.vala
Imported Upstream version 0.18.1upstream/0.18.1
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;
+ }
+}
+