[cheese/gsettings-vala] Added configurable flash option



commit f5901a86e3b3a5654c79c42d0d201f5f925a7591
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date:   Sat Aug 7 02:20:34 2010 +0530

    Added configurable flash option

 data/org.gnome.Cheese.gschema.xml |    8 ++++++++
 libcheese/cheese-gconf.c          |   17 +++++++++++++++--
 libcheese/cheese-gconf.h          |    1 +
 src/cheese-window.vala            |    5 ++++-
 src/vapi/cheese-common.vapi       |    2 ++
 5 files changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/data/org.gnome.Cheese.gschema.xml b/data/org.gnome.Cheese.gschema.xml
index 9c9fbdc..6756248 100644
--- a/data/org.gnome.Cheese.gschema.xml
+++ b/data/org.gnome.Cheese.gschema.xml
@@ -8,6 +8,14 @@
       <default>true</default>
     </key>
 
+    <key name='flash' type='b'>
+      <summary>Fire flash before taking a picture</summary>
+      <description>
+        Set to True to fire a flash before taking a picture
+      </description>
+      <default>true</default>
+    </key>
+    
     <key name='camera' type='s'>
       <summary>Camera device string indicator</summary>
       <description>
diff --git a/libcheese/cheese-gconf.c b/libcheese/cheese-gconf.c
index ae340db..ce8e186 100644
--- a/libcheese/cheese-gconf.c
+++ b/libcheese/cheese-gconf.c
@@ -48,7 +48,6 @@ cheese_gconf_get_property (GObject *object, guint prop_id, GValue *value,
   self = CHEESE_GCONF (object);
   CheeseGConfPrivate *priv = CHEESE_GCONF_GET_PRIVATE (self);
 
-  GSList *list, *tmp;
   char *temp_str;
   gboolean temp_bool;
   int temp_int;
@@ -60,6 +59,10 @@ cheese_gconf_get_property (GObject *object, guint prop_id, GValue *value,
       g_settings_get (priv->settings, "countdown", "b", &temp_bool);
       g_value_set_boolean (value, temp_bool);
       break;
+  case GCONF_PROP_FLASH:
+      g_settings_get (priv->settings, "flash", "b", &temp_bool);
+      g_value_set_boolean (value, temp_bool);
+      break;
     case GCONF_PROP_CAMERA:
       g_settings_get (priv->settings, "camera", "s", &temp_str);
       g_value_set_string (value, temp_str);
@@ -136,7 +139,10 @@ cheese_gconf_set_property (GObject *object, guint prop_id, const GValue *value,
     case GCONF_PROP_COUNTDOWN:
       g_settings_set (priv->settings, "countdown", "b", g_value_get_boolean (value));
       break;
-    case GCONF_PROP_CAMERA:
+  case GCONF_PROP_FLASH:
+      g_settings_set (priv->settings, "flash", "b", g_value_get_boolean (value));
+      break;
+  case GCONF_PROP_CAMERA:
       g_settings_set (priv->settings, "camera", "s", g_value_get_string (value));
       break;
   case GCONF_PROP_SELECTED_EFFECT:
@@ -209,6 +215,13 @@ cheese_gconf_class_init (CheeseGConfClass *klass)
                                                          NULL,
                                                          FALSE,
                                                          G_PARAM_READWRITE));
+  g_object_class_install_property (object_class, GCONF_PROP_FLASH,
+                                   g_param_spec_boolean ("gconf_prop_flash",
+                                                         NULL,
+                                                         NULL,
+                                                         FALSE,
+                                                         G_PARAM_READWRITE));
+
   g_object_class_install_property (object_class, GCONF_PROP_CAMERA,
                                    g_param_spec_string ("gconf_prop_camera",
                                                         NULL,
diff --git a/libcheese/cheese-gconf.h b/libcheese/cheese-gconf.h
index f11dc1a..8b132fc 100644
--- a/libcheese/cheese-gconf.h
+++ b/libcheese/cheese-gconf.h
@@ -44,6 +44,7 @@ enum
   GCONF_PROP_0,
   GCONF_PROP_COUNTDOWN,
   GCONF_PROP_CAMERA,
+  GCONF_PROP_FLASH,
   GCONF_PROP_SELECTED_EFFECT,
   GCONF_PROP_X_RESOLUTION,
   GCONF_PROP_Y_RESOLUTION,
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 44ecadf..9c65ba1 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -549,7 +549,10 @@ public class Cheese.MainWindow : Gtk.Window
   {
     string file_name = fileutil.get_new_media_filename (this.current_mode);
 
-    this.flash.fire ();
+	if (conf.gconf_prop_flash)
+	{
+		this.flash.fire ();
+	}
     this.camera.take_photo (file_name);
   }
 
diff --git a/src/vapi/cheese-common.vapi b/src/vapi/cheese-common.vapi
index df235a6..097a8af 100644
--- a/src/vapi/cheese-common.vapi
+++ b/src/vapi/cheese-common.vapi
@@ -133,6 +133,8 @@ namespace Cheese
     [NoAccessorMethod]
     public bool gconf_prop_countdown {get; set;}
     [NoAccessorMethod]
+	public bool gconf_prop_flash {get; set;}
+    [NoAccessorMethod]
     public double gconf_prop_hue {get; set;}
     [NoAccessorMethod]
     public string gconf_prop_photo_path {owned get; set;}



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