[cheese/three-point-oh] Resolution combo box in preferences window works
- From: Yuvaraj Pandian <yuvipanda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/three-point-oh] Resolution combo box in preferences window works
- Date: Tue, 13 Jul 2010 20:49:06 +0000 (UTC)
commit 087e084b0b3685119d23c52fbf446a05d5659fd7
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date: Wed Jul 14 02:18:17 2010 +0530
Resolution combo box in preferences window works
data/cheese-prefs.ui | 1 +
src/cheese-preferences.vala | 46 ++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/data/cheese-prefs.ui b/data/cheese-prefs.ui
index 244d797..8190144 100644
--- a/data/cheese-prefs.ui
+++ b/data/cheese-prefs.ui
@@ -138,6 +138,7 @@
<object class="GtkComboBox" id="resolution_combo_box">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <signal name="changed" handler="cheese_preferences_dialog_on_resolution_change" />
</object>
<packing>
<property name="position">1</property>
diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
index 1d0514a..c347ae8 100644
--- a/src/cheese-preferences.vala
+++ b/src/cheese-preferences.vala
@@ -70,6 +70,35 @@ internal class Cheese.PreferencesDialog : GLib.Object
CellRendererText cell = new CellRendererText ();
source_combo.pack_start (cell, false);
source_combo.set_attributes (cell, "text", 0);
+
+ setup_resolutions_for_device (camera.get_selected_device ());
+ }
+
+ private void setup_resolutions_for_device (Cheese.CameraDevice device)
+ {
+ unowned List<VideoFormat> formats = device.get_format_list ();
+ ListStore model = new ListStore (2, typeof (string), typeof (Cheese.VideoFormat));
+ unowned Cheese.VideoFormat format;
+
+ resolution_combo.model = model;
+
+ for (int i = 0; i < formats.length (); i++)
+ {
+ TreeIter iter;
+ format = formats<VideoFormat>.nth (i).data;
+ model.append (out iter);
+ model.set (iter,
+ 0, format.width.to_string () + " x " + format.height.to_string (),
+ 1, format);
+ if (camera.get_current_video_format ().width == format.width &&
+ camera.get_current_video_format ().height == format.height)
+ {
+ resolution_combo.set_active_iter (iter);
+ }
+ }
+ CellRendererText cell = new CellRendererText ();
+ resolution_combo.pack_start (cell, false);
+ resolution_combo.set_attributes (cell, "text", 0);
}
private void initialize_values_from_conf ()
@@ -94,11 +123,26 @@ internal class Cheese.PreferencesDialog : GLib.Object
combo.model.get (iter, 1, out dev);
camera.set_device_by_dev_file (dev.get_device_file ());
camera.switch_camera_device ();
-
+ setup_resolutions_for_device (camera.get_selected_device ());
conf.gconf_prop_camera = dev.get_device_file ();
}
[CCode (instance_pos = -1)]
+ internal void on_resolution_change (Gtk.ComboBox combo)
+ {
+ TreeIter iter;
+
+ unowned Cheese.VideoFormat format;
+
+ combo.get_active_iter (out iter);
+ combo.model.get (iter, 1, out format);
+ camera.set_video_format (format);
+
+ conf.gconf_prop_x_resolution = format.width;
+ conf.gconf_prop_y_resolution = format.height;
+ }
+
+ [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]