[cheese/tpo: 1/6] Back to uglier properties till I can fix them



commit d3e0f67b06465ebbe7b5cda6d3d9df6c1f0acd84
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date:   Sat Jun 19 02:40:59 2010 +0530

    Back to uglier properties till I can fix them

 valasrc/cheese-window.vala      |   46 ++++++++++++++++++++----------
 valasrc/vapi/cheese-common.vapi |   60 +++++++++++++++++++-------------------
 2 files changed, 61 insertions(+), 45 deletions(-)
---
diff --git a/valasrc/cheese-window.vala b/valasrc/cheese-window.vala
index 2f1bc9e..347da77 100644
--- a/valasrc/cheese-window.vala
+++ b/valasrc/cheese-window.vala
@@ -46,7 +46,9 @@ public class Cheese.MainWindow : Gtk.Window
   private Gtk.Action video_mode_action;
   private Gtk.Action burst_mode_action;
   private Gtk.Action effects_toggle_action;
-
+  private Gtk.Action wide_mode_action;
+  private Gtk.Action countdown_action;
+  
   private bool is_fullscreen;
   private bool is_wide_mode;
   private bool is_recording;       /* Video Recording Flag */
@@ -252,6 +254,7 @@ public class Cheese.MainWindow : Gtk.Window
   private void set_wide_mode (bool wide_mode, bool initialize = false)
   {
     is_wide_mode = wide_mode;
+	conf.gconf_prop_wide_mode = wide_mode;
     if (!initialize)
     {
       /* Sets requested size of the viewport_widget to be it's current size
@@ -306,26 +309,37 @@ public class Cheese.MainWindow : Gtk.Window
     this.viewport_layout.set_size (viewport.width, viewport.height);
   }
 
+    [CCode (instance_pos = -1)]
+	internal void on_countdown_toggle (ToggleAction action)
+  {
+    conf.gconf_prop_countdown = action.active;
+  }
+
   private void finish_countdown_callback ()
   {
     string file_name = fileutil.get_new_media_filename (this.current_mode);
-
-    this.flash.fire ();
+	this.flash.fire ();
     this.camera.take_photo (file_name);
   }
 
   internal void take_photo ()
   {
-    Countdown cd = new Countdown (this.countdown_layer);
-
-    cd.start_countdown (finish_countdown_callback);
+	  if (conf.gconf_prop_countdown)
+	  {
+		  Countdown cd = new Countdown (this.countdown_layer);
+		  cd.start_countdown (finish_countdown_callback);
+	  }
+	  else
+	  {
+		  finish_countdown_callback();
+	  }
   }
 
   private int burst_count;
 
   private bool burst_take_photo ()
   {
-    if (is_bursting && burst_count < 3)
+    if (is_bursting && burst_count < conf.gconf_prop_burst_repeat)
     {
       this.take_photo ();
       burst_count++;
@@ -390,7 +404,7 @@ public class Cheese.MainWindow : Gtk.Window
     clutter_builder = new Clutter.Script ();
     fileutil        = new FileUtil ();
     flash           = new Flash (this);
-
+	conf = new GConf();
     gtk_builder.add_from_file (GLib.Path.build_filename (Config.PACKAGE_DATADIR, "cheese-actions.ui"));
     gtk_builder.add_from_file (GLib.Path.build_filename (Config.PACKAGE_DATADIR, "cheese-about.ui"));
     gtk_builder.add_from_file (GLib.Path.build_filename (Config.PACKAGE_DATADIR, "cheese-main-window.ui"));
@@ -417,13 +431,15 @@ public class Cheese.MainWindow : Gtk.Window
     buttons_area                      = (Gtk.HBox)gtk_builder.get_object ("buttons_area");
 
     take_photo_action     = (Gtk.Action)gtk_builder.get_object ("take_photo");
-    take_video_action     = (Gtk.Action)gtk_builder.get_object ("take_video");;
-    take_burst_action     = (Gtk.Action)gtk_builder.get_object ("take_burst");;
+    take_video_action     = (Gtk.Action)gtk_builder.get_object ("take_video");
+    take_burst_action     = (Gtk.Action)gtk_builder.get_object ("take_burst");
     photo_mode_action     = (Gtk.Action)gtk_builder.get_object ("photo_mode");
-    video_mode_action     = (Gtk.Action)gtk_builder.get_object ("video_mode");;
-    burst_mode_action     = (Gtk.Action)gtk_builder.get_object ("burst_mode");;
+    video_mode_action     = (Gtk.Action)gtk_builder.get_object ("video_mode");
+    burst_mode_action     = (Gtk.Action)gtk_builder.get_object ("burst_mode");
     effects_toggle_action = (Gtk.Action)gtk_builder.get_object ("effects_toggle");
-
+	countdown_toggle_action= (Gtk.Action)gtk_builder.get_object ("countdown");
+	wide_mode_action = (Gtk.Action)gtk_builder.get_object("wide_mode");
+	
     /* Array contains all 'buttons', for easier manipulation
      * IMPORTANT: IF ANOTHER BUTTON IS ADDED UNDER THE VIEWPORT, ADD IT TO THIS ARRAY */
     buttons = {photo_toggle_button,
@@ -451,10 +467,10 @@ public class Cheese.MainWindow : Gtk.Window
 
     viewport.show_all ();
 
-    camera.setup (conf.camera);
+    camera.setup (conf.gconf_prop_camera);
     camera.play ();
 
-    set_wide_mode (true, true);
+    set_wide_mode (conf.gconf_prop_wide_mode, true);
     set_mode (MediaMode.PHOTO);
 
     this.add (main_vbox);
diff --git a/valasrc/vapi/cheese-common.vapi b/valasrc/vapi/cheese-common.vapi
index 8191541..f9da177 100644
--- a/valasrc/vapi/cheese-common.vapi
+++ b/valasrc/vapi/cheese-common.vapi
@@ -101,36 +101,36 @@ namespace Cheese
   {
     [CCode (has_construct_function = false)]
     public GConf ();
-    [NoAccessorMethod, CCode (cname = "gconf_prop_brightness")]
-    public double brightness {get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_burst_delay")]
-    public int burst_delay {get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_burst_repeat")]
-    public int burst_repeat {get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_camera")]
-    public string camera {owned get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_contrast")]
-    public double contrast {get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_countdown")]
-    public bool countdown {get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_enable_delete")]
-    public bool enable_delete {get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_hue")]
-    public double hue {get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_photo_path")]
-    public string photo_path {owned get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_saturation")]
-    public double saturation {get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_selected_effects")]
-    public string selected_effects {owned get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_video_path")]
-    public string video_path {owned get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_wide_mode")]
-    public bool wide_mode {get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_x_resolution")]
-    public int x_resolution {get; set;}
-    [NoAccessorMethod, CCode (cname = "gconf_prop_y_resolution")]
-    public int y_resolution {get; set;}
+    [NoAccessorMethod]
+    public double gconf_prop_brightness {get; set;}
+    [NoAccessorMethod]
+    public int gconf_prop_burst_delay {get; set;}
+    [NoAccessorMethod]
+    public int gconf_prop_burst_repeat {get; set;}
+    [NoAccessorMethod]
+    public string gconf_prop_camera {owned get; set;}
+    [NoAccessorMethod]
+    public double gconf_prop_contrast {get; set;}
+    [NoAccessorMethod]
+    public bool gconf_prop_countdown {get; set;}
+    [NoAccessorMethod]
+    public bool gconf_prop_enable_delete {get; set;}
+    [NoAccessorMethod]
+    public double gconf_prop_hue {get; set;}
+    [NoAccessorMethod]
+    public string gconf_prop_photo_path {owned get; set;}
+    [NoAccessorMethod]
+    public double gconf_prop_saturation {get; set;}
+    [NoAccessorMethod]
+    public string gconf_prop_selected_effects {owned get; set;}
+    [NoAccessorMethod]
+    public string gconf_prop_video_path {owned get; set;}
+    [NoAccessorMethod]
+    public bool gconf_prop_wide_mode {get; set;}
+    [NoAccessorMethod]
+    public int gconf_prop_x_resolution {get; set;}
+    [NoAccessorMethod]
+    public int gconf_prop_y_resolution {get; set;}
   }
 
   [Compact]



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