[cheese] Inhibit user switching and session idle



commit e799707762b7e338f1e0c48a6099ad9e5a48c2ba
Author: David King <amigadave amigadave com>
Date:   Mon Mar 31 18:54:40 2014 +0100

    Inhibit user switching and session idle
    
    As recording video from a webcam is undesirable when combined with
    switching users, inhibit switching and session idling.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694214

 src/cheese-application.vala |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/cheese-application.vala b/src/cheese-application.vala
index 7c20821..7361c0d 100644
--- a/src/cheese-application.vala
+++ b/src/cheese-application.vala
@@ -27,6 +27,7 @@ using Gst;
 public class Cheese.Application : Gtk.Application
 {
     private GLib.Settings settings;
+    private uint inhibited = 0;
 
     static string device;
 
@@ -307,6 +308,11 @@ public class Cheese.Application : Gtk.Application
                 effects.set_enabled (true);
 
                 main_window.camera_state_change_playing ();
+
+                inhibited = this.inhibit (main_window,
+                                          Gtk.ApplicationInhibitFlags.SWITCH
+                                          | Gtk.ApplicationInhibitFlags.IDLE,
+                                          _("Webcam in use"));
                 break;
             case Gst.State.NULL:
                 effects.set_enabled (false);
@@ -314,6 +320,11 @@ public class Cheese.Application : Gtk.Application
                 shoot.set_enabled (false);
 
                 main_window.camera_state_change_null ();
+
+                if (inhibited != 0)
+                {
+                    this.uninhibit (inhibited);
+                }
                 break;
             default:
                 break;


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