[cheese/three-point-oh] Initial work on preferences window.



commit ca9e8bcfd1ef1a7c8f55e1b0535c648e41777d0a
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date:   Tue Jul 13 23:36:37 2010 +0530

    Initial work on preferences window.
    
    Window just shows up and does nothing

 TODO                        |    1 -
 data/cheese-prefs.ui        |   45 +++++++++++++++++++++++++++++----
 src/Makefile.am             |    1 +
 src/cheese-preferences.vala |   58 +++++++++++++++++++++++++++++++++++++++++++
 src/cheese-window.vala      |   21 +++++++++++----
 5 files changed, 113 insertions(+), 13 deletions(-)
---
diff --git a/TODO b/TODO
index cebc132..d56b681 100644
--- a/TODO
+++ b/TODO
@@ -4,7 +4,6 @@ please fix me before 3.0
 9 move all to trash does not work
 9 video recording is not working, check video_save_bin and photo_save_bin
   pipeline elements
-7 wide mode does not work in the moment the viewport is loading
 6 move to gsettings
 6 show a throbber when doing something which could take some time, e.g.
   changing effects, loading webcam, starting recording video
diff --git a/data/cheese-prefs.ui b/data/cheese-prefs.ui
index b6126a5..2d5e7a0 100644
--- a/data/cheese-prefs.ui
+++ b/data/cheese-prefs.ui
@@ -2,14 +2,42 @@
 <interface>
   <requires lib="gtk+" version="2.16"/>
   <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkAdjustment" id="adjustment1">
+  <object class="GtkAdjustment" id="brightness_adjustment">
     <property name="value">2</property>
     <property name="lower">3</property>
     <property name="upper">100</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
-  <object class="GtkAdjustment" id="adjustment2">
+  <object class="GtkAdjustment" id="contrast_adjustment">
+    <property name="value">2</property>
+    <property name="lower">3</property>
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="hue_adjustment">
+    <property name="value">2</property>
+    <property name="lower">3</property>
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="saturation_adjustment">
+    <property name="value">2</property>
+    <property name="lower">3</property>
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="burst_count_adjustment">
+    <property name="value">2</property>
+    <property name="lower">3</property>
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="burst_delay_adjustment">
     <property name="lower">1</property>
     <property name="upper">100</property>
     <property name="step_increment">1</property>
@@ -231,6 +259,7 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="draw_value">False</property>
+                            <property name="adjustment">brightness_adjustment</property>
                           </object>
                           <packing>
                             <property name="position">0</property>
@@ -241,6 +270,7 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="draw_value">False</property>
+                            <property name="adjustment">contrast_adjustment</property>
                           </object>
                           <packing>
                             <property name="position">1</property>
@@ -251,6 +281,7 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="draw_value">False</property>
+                            <property name="adjustment">saturation_adjustment</property>
                           </object>
                           <packing>
                             <property name="position">2</property>
@@ -261,6 +292,7 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="draw_value">False</property>
+                            <property name="adjustment">hue_adjustment</property>
                           </object>
                           <packing>
                             <property name="position">3</property>
@@ -355,7 +387,7 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="invisible_char">&#x25CF;</property>
-                            <property name="adjustment">adjustment1</property>
+                            <property name="adjustment">burst_count_adjustment</property>
                           </object>
                           <packing>
                             <property name="position">0</property>
@@ -366,7 +398,7 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="invisible_char">&#x25CF;</property>
-                            <property name="adjustment">adjustment2</property>
+                            <property name="adjustment">burst_delay_adjustment</property>
                           </object>
                           <packing>
                             <property name="position">1</property>
@@ -406,13 +438,14 @@
             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="button1">
+              <object class="GtkButton" id="close">
                 <property name="label">gtk-close</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                 <property name="use_stock">True</property>
+                <signal name="clicked" handler="cheese_preferences_dialog_on_dialog_close" />
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -430,7 +463,7 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="0">button1</action-widget>
+      <action-widget response="-7">close</action-widget>
     </action-widgets>
   </object>
 </interface>
diff --git a/src/Makefile.am b/src/Makefile.am
index c8157e1..ff8a80d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,6 +39,7 @@ cheese_SOURCES = \
 	cheese-window.vala \
 	cheese-countdown.vala \
 	cheese-effects-manager.vala \
+	cheese-preferences.vala \
 	thumbview/cheese-gconf.c \
 	thumbview/cheese-thumb-view.c \
 	thumbview/eog-thumb-nav.c \
diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
new file mode 100644
index 0000000..63e79f5
--- /dev/null
+++ b/src/cheese-preferences.vala
@@ -0,0 +1,58 @@
+using Gtk;
+
+internal class Cheese.PreferencesDialog : GLib.Object
+{
+  private Cheese.Camera camera;
+  private Cheese.GConf  conf;
+
+  private Gtk.Dialog dialog;
+
+  private Gtk.ComboBox resolution_combo;
+  private Gtk.ComboBox source_combo;
+
+  private Gtk.Adjustment brightness_adjustment;
+  private Gtk.Adjustment contrast_adjustment;
+  private Gtk.Adjustment hue_adjustment;
+  private Gtk.Adjustment saturation_adjustment;
+
+  private Gtk.SpinButton burst_count_spin;
+  private Gtk.SpinButton burst_delay_spin;
+
+  private Gtk.Button close_button;
+
+  public PreferencesDialog (Cheese.Camera camera, Cheese.GConf conf)
+  {
+    this.camera = camera;
+    this.conf   = conf;
+
+    Gtk.Builder builder = new Gtk.Builder ();
+    builder.add_from_file (GLib.Path.build_filename (Config.PACKAGE_DATADIR, "cheese-prefs.ui"));
+    builder.connect_signals (this);
+
+    this.dialog = (Gtk.Dialog)builder.get_object ("cheese_prefs_dialog");
+
+    this.brightness_adjustment = (Gtk.Adjustment)builder.get_object ("brightness_adjustment");
+    this.contrast_adjustment   = (Gtk.Adjustment)builder.get_object ("contrast_adjustment");
+    this.hue_adjustment        = (Gtk.Adjustment)builder.get_object ("hue_adjustment");
+    this.saturation_adjustment = (Gtk.Adjustment)builder.get_object ("saturation_adjustment");
+
+    this.resolution_combo = (Gtk.ComboBox)builder.get_object ("resolution_combo_box");
+    this.source_combo     = (Gtk.ComboBox)builder.get_object ("camera_combo_box");
+
+    this.burst_count_spin = (Gtk.SpinButton)builder.get_object ("burst_count");
+    this.burst_delay_spin = (Gtk.SpinButton)builder.get_object ("burst_delay");
+
+    this.close_button = (Gtk.Button)builder.get_object ("close");
+  }
+
+  [CCode (instance_pos = -1)]
+  internal void on_dialog_close (Gtk.Button button)
+  {
+    this.dialog.hide_all ();
+  }
+
+  public void show ()
+  {
+    this.dialog.show_all ();
+  }
+}
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index fdf11c3..7fa23d3 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -69,11 +69,12 @@ public class Cheese.MainWindow : Gtk.Window
 
   private Gtk.Button[] buttons;
 
-  private Cheese.Camera         camera;
-  private Cheese.FileUtil       fileutil;
-  private Cheese.Flash          flash;
-  private Cheese.GConf          conf;
-  private Cheese.EffectsManager effects_manager;
+  private Cheese.Camera            camera;
+  private Cheese.FileUtil          fileutil;
+  private Cheese.Flash             flash;
+  private Cheese.GConf             conf;
+  private Cheese.EffectsManager    effects_manager;
+  private Cheese.PreferencesDialog preferences_dialog;
 
   private Cheese.Effect selected_effect;
 
@@ -83,6 +84,12 @@ public class Cheese.MainWindow : Gtk.Window
     destroy ();
   }
 
+  [CCode (instance_pos = -1)]
+  internal void on_preferences_dialog (Gtk.Action action)
+  {
+    preferences_dialog.show ();
+  }
+
   internal bool on_thumbnail_mouse_button_press (Gtk.Widget      iconview,
                                                  Gdk.EventButton event)
   {
@@ -107,7 +114,7 @@ public class Cheese.MainWindow : Gtk.Window
       }
     }
     else
-    if (event.type == Gdk.EventType.2BUTTON_PRESS)
+    if (event.type == Gdk.EventType .2BUTTON _PRESS)
     {
       on_file_open (null);
     }
@@ -814,5 +821,7 @@ public class Cheese.MainWindow : Gtk.Window
     /* apparently set_active doesn't emit toggled nothing has
      * changed, do it manually */
     if (!conf.gconf_prop_wide_mode) wide_mode_action.toggled ();
+
+    preferences_dialog = new Cheese.PreferencesDialog (camera, conf);
   }
 }



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