[cheese] Add a countdown-duration key to GSettings schema



commit 073102ac20fbe535f44402922d96e80c73a7c11a
Author: Adrian ZgorzaÅek <a zgorzalek gmail com>
Date:   Tue Nov 1 19:19:58 2011 +0100

    Add a countdown-duration key to GSettings schema
    
    Add a new GSettings key to allow configuration of the duration of the
    countdown when taking a photo. Partially fixes bug 594267.

 data/org.gnome.Cheese.gschema.xml.in |    9 +++++++++
 src/cheese-countdown.vala            |    7 ++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/data/org.gnome.Cheese.gschema.xml.in b/data/org.gnome.Cheese.gschema.xml.in
index f484b99..e56d30b 100644
--- a/data/org.gnome.Cheese.gschema.xml.in
+++ b/data/org.gnome.Cheese.gschema.xml.in
@@ -8,6 +8,15 @@
       <default>true</default>
     </key>
 
+    <key name='countdown-duration' type='i'>
+      <range min="1" max="10"/>
+      <_summary>Countdown length</_summary>
+      <_description>
+        The duration of the countdown before taking a photo, in seconds
+      </_description>
+      <default>3</default>
+    </key>
+
     <key name='flash' type='b'>
       <_summary>Fire flash before taking a picture</_summary>
       <_description>
diff --git a/src/cheese-countdown.vala b/src/cheese-countdown.vala
index 4969500..097e464 100644
--- a/src/cheese-countdown.vala
+++ b/src/cheese-countdown.vala
@@ -22,8 +22,6 @@
 using GLib;
 using Clutter;
 
-const int COUNTDOWN_START = 3;
-
 internal class Cheese.Countdown : GLib.Object
 {
   public delegate void CountdownCallback ();
@@ -38,11 +36,14 @@ internal class Cheese.Countdown : GLib.Object
 
   private static Clutter.Animation anim;
 
+  private static GLib.Settings settings;
+
   public bool running;
 
   public Countdown (Clutter.Text countdown_actor)
   {
     this.countdown_actor = countdown_actor;
+    settings             = new GLib.Settings("org.gnome.Cheese");
   }
 
   private void fade_out ()
@@ -69,7 +70,7 @@ internal class Cheese.Countdown : GLib.Object
   public void start (CountdownCallback completed_callback)
   {
     this.completed_callback = completed_callback;
-    this.current_value      = COUNTDOWN_START;
+    this.current_value = settings.get_int("countdown-duration");
     running = true;
     countdown_actor.show ();
     fade_in ();



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