[cheese] Fix preferences to use the new api



commit 2d4be65d7076aeae998b5f531bee65084b2059b5
Author: Filippo Argiolas <filippo argiolas gmail com>
Date:   Sun Dec 13 19:45:19 2009 +0100

    Fix preferences to use the new api

 libcheese/cheese-camera.c           |    2 --
 src/cheese-prefs-camera-combo.c     |   14 ++++++++------
 src/cheese-prefs-dialog.c           |    2 --
 src/cheese-prefs-resolution-combo.c |   12 +++++++-----
 4 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index b91d7a6..9096aa9 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -740,14 +740,12 @@ cheese_camera_play (CheeseCamera *camera)
 
   if (gst_caps_is_empty (caps))
   {
-    g_warning ("CAPS_ARE_EMPTY");
     gst_caps_unref (caps);
     g_boxed_free (CHEESE_TYPE_VIDEO_FORMAT, priv->current_format);
     priv->current_format = cheese_camera_device_get_best_format (device);
     g_object_notify (G_OBJECT (camera), "format");
     caps = cheese_camera_device_get_caps_for_format (device, priv->current_format);
     if (G_UNLIKELY (gst_caps_is_empty (caps))) {
-      g_warning ("CAPS_ARE_STILL_EMPTY");
       gst_caps_unref (caps);
       caps = gst_caps_new_any ();
     }
diff --git a/src/cheese-prefs-camera-combo.c b/src/cheese-prefs-camera-combo.c
index 02e24dc..018a4fc 100644
--- a/src/cheese-prefs-camera-combo.c
+++ b/src/cheese-prefs-camera-combo.c
@@ -95,7 +95,6 @@ cheese_prefs_camera_combo_selection_changed (GtkComboBox *combo_box, CheesePrefs
 static void
 cheese_prefs_camera_combo_synchronize (CheesePrefsWidget *prefs_widget)
 {
-#if 0
   CheesePrefsCameraCombo        *self = CHEESE_PREFS_CAMERA_COMBO (prefs_widget);
   CheesePrefsCameraComboPrivate *priv = CHEESE_PREFS_CAMERA_COMBO_GET_PRIVATE (self);
 
@@ -134,10 +133,11 @@ cheese_prefs_camera_combo_synchronize (CheesePrefsWidget *prefs_widget)
    * Not sure if this is desired behavior */
   if (num_devices > 0)
   {
+    const gchar *devpath = cheese_camera_device_get_device_file (selected_device);
     g_object_get (prefs_widget->gconf, priv->camera_device_key, &gconf_device_name, NULL);
-    if (!gconf_device_name || strcmp (selected_device->video_device, gconf_device_name) != 0)
+    if (!gconf_device_name || strcmp (devpath, gconf_device_name) != 0)
     {
-      g_object_set (prefs_widget->gconf, priv->camera_device_key, selected_device->video_device, NULL);
+      g_object_set (prefs_widget->gconf, priv->camera_device_key, devpath, NULL);
     }
     g_free (gconf_device_name);
   }
@@ -146,8 +146,11 @@ cheese_prefs_camera_combo_synchronize (CheesePrefsWidget *prefs_widget)
   for (i = 0; i < num_devices; i++)
   {
     device_ptr   = g_ptr_array_index (camera_devices, i);
-    product_name = g_strdup_printf ("%s (%s)", device_ptr->product_name, device_ptr->video_device);
-    device_name  = g_strdup (device_ptr->video_device);
+    const gchar *devpath = cheese_camera_device_get_device_file (device_ptr);
+    product_name = g_strdup_printf ("%s (%s)",
+                                    cheese_camera_device_get_name (device_ptr),
+                                    devpath);
+    device_name  = g_strdup (devpath);
 
     gtk_list_store_append (priv->list_store, &iter);
     gtk_list_store_set (priv->list_store, &iter, PRODUCT_NAME, product_name,
@@ -181,7 +184,6 @@ cheese_prefs_camera_combo_synchronize (CheesePrefsWidget *prefs_widget)
   gtk_widget_set_sensitive (combo_box, num_devices > 1);
 
   g_ptr_array_unref (camera_devices);
-#endif
 }
 
 static void
diff --git a/src/cheese-prefs-dialog.c b/src/cheese-prefs-dialog.c
index 1c0334a..4d6448b 100644
--- a/src/cheese-prefs-dialog.c
+++ b/src/cheese-prefs-dialog.c
@@ -88,10 +88,8 @@ cheese_prefs_dialog_on_resolution_changed (CheesePrefsWidget *widget, gpointer u
   current_format = cheese_camera_get_current_video_format (camera);
   new_format     = cheese_prefs_resolution_combo_get_selected_format (CHEESE_PREFS_RESOLUTION_COMBO (widget));
 
-#if 0
   if (new_format != current_format)
     cheese_camera_set_video_format (camera, new_format);
-#endif
 }
 
 static void
diff --git a/src/cheese-prefs-resolution-combo.c b/src/cheese-prefs-resolution-combo.c
index 1cbe68a..9b08b21 100644
--- a/src/cheese-prefs-resolution-combo.c
+++ b/src/cheese-prefs-resolution-combo.c
@@ -113,7 +113,8 @@ cheese_prefs_resolution_combo_synchronize (CheesePrefsWidget *prefs_widget)
 
   GtkWidget         *combo_box;
   CheeseVideoFormat *current_format;
-  GArray            *formats;
+  GList             *formats;
+  GList             *l;
   int                i;
   CheeseVideoFormat *format;
   gchar             *format_name;
@@ -138,12 +139,11 @@ cheese_prefs_resolution_combo_synchronize (CheesePrefsWidget *prefs_widget)
   gtk_list_store_clear (priv->list_store);
   formats = cheese_camera_get_video_formats (priv->camera);
 
-  for (i = 0; i < formats->len; i++)
+  for (l = formats; l != NULL; l = l->next)
   {
-    format      = &g_array_index (formats, CheeseVideoFormat, i);
+    format = l->data;
     format_name = g_strdup_printf ("%i x %i", format->width, format->height);
 
-
     if (format->width <= priv->max_x_resolution &&
         format->height <= priv->max_y_resolution)
     {
@@ -176,7 +176,9 @@ cheese_prefs_resolution_combo_synchronize (CheesePrefsWidget *prefs_widget)
                     G_CALLBACK (combo_selection_changed),
                     self);
 
-  gtk_widget_set_sensitive (combo_box, formats->len > 1);
+  gtk_widget_set_sensitive (combo_box, formats != NULL);
+  g_list_free (formats);
+  g_list_free (l);
 }
 
 static void



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