[cheese/three-point-oh] Selecting from different camera sources works
- From: Yuvaraj Pandian <yuvipanda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/three-point-oh] Selecting from different camera sources works
- Date: Tue, 13 Jul 2010 20:14:25 +0000 (UTC)
commit ea62cd11aaa737ad71c86f9860899301409fed56
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date: Wed Jul 14 01:43:40 2010 +0530
Selecting from different camera sources works
data/cheese-prefs.ui | 1 +
src/cheese-preferences.vala | 44 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/data/cheese-prefs.ui b/data/cheese-prefs.ui
index eca1a6f..244d797 100644
--- a/data/cheese-prefs.ui
+++ b/data/cheese-prefs.ui
@@ -128,6 +128,7 @@
<child>
<object class="GtkComboBox" id="camera_combo_box">
<property name="visible">True</property>
+ <signal name="changed" handler="cheese_preferences_dialog_on_source_change" />
</object>
<packing>
<property name="position">0</property>
diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
index 9c0fa0b..1d0514a 100644
--- a/src/cheese-preferences.vala
+++ b/src/cheese-preferences.vala
@@ -40,9 +40,38 @@ internal class Cheese.PreferencesDialog : GLib.Object
this.burst_repeat_spin = (Gtk.SpinButton)builder.get_object ("burst_repeat");
this.burst_delay_spin = (Gtk.SpinButton)builder.get_object ("burst_delay");
+ initialize_camera_devices ();
initialize_values_from_conf ();
}
+ private void initialize_camera_devices ()
+ {
+ Cheese.CameraDevice dev;
+ TreeIter active_dev;
+ unowned GLib.PtrArray devices = camera.get_camera_devices ();
+ ListStore model = new ListStore (2, typeof (string), typeof (Cheese.CameraDevice));
+
+ source_combo.model = model;
+
+ for (int i = 0; i < devices.len; i++)
+ {
+ TreeIter iter;
+ dev = (Cheese.CameraDevice)devices.index (i);
+ model.append (out iter);
+ model.set (iter,
+ 0, dev.get_name () + " (" + dev.get_device_file () + " )",
+ 1, dev);
+ if (camera.get_selected_device ().get_device_file () == dev.get_device_file ())
+ {
+ source_combo.set_active_iter (iter);
+ }
+ }
+
+ CellRendererText cell = new CellRendererText ();
+ source_combo.pack_start (cell, false);
+ source_combo.set_attributes (cell, "text", 0);
+ }
+
private void initialize_values_from_conf ()
{
brightness_adjustment.value = conf.gconf_prop_brightness;
@@ -55,6 +84,21 @@ internal class Cheese.PreferencesDialog : GLib.Object
}
[CCode (instance_pos = -1)]
+ internal void on_source_change (Gtk.ComboBox combo)
+ {
+ TreeIter iter;
+
+ Cheese.CameraDevice dev;
+
+ combo.get_active_iter (out iter);
+ combo.model.get (iter, 1, out dev);
+ camera.set_device_by_dev_file (dev.get_device_file ());
+ camera.switch_camera_device ();
+
+ conf.gconf_prop_camera = dev.get_device_file ();
+ }
+
+ [CCode (instance_pos = -1)]
internal void on_dialog_close (Gtk.Button button)
{
this.dialog.hide_all ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]