Blame SOURCES/0048-cheese-preferences-Simplify-remove_camera_device.patch

ecdf9b
From 4684d5a009f1bf3b4c7d2fc92456fc506ba1f254 Mon Sep 17 00:00:00 2001
ecdf9b
From: Hans de Goede <hdegoede@redhat.com>
ecdf9b
Date: Wed, 19 Jun 2013 16:47:41 +0200
ecdf9b
Subject: [PATCH 48/50] cheese-preferences: Simplify remove_camera_device
ecdf9b
ecdf9b
Now that we cache the device-node for the active camera, remove_camera_device
ecdf9b
and its callers can be simplified.
ecdf9b
ecdf9b
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ecdf9b
---
ecdf9b
 src/cheese-preferences.vala | 19 ++++++-------------
ecdf9b
 1 file changed, 6 insertions(+), 13 deletions(-)
ecdf9b
ecdf9b
diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
ecdf9b
index 219c685..a1316f9 100644
ecdf9b
--- a/src/cheese-preferences.vala
ecdf9b
+++ b/src/cheese-preferences.vala
ecdf9b
@@ -491,12 +491,6 @@ public class Cheese.PreferencesDialog : GLib.Object
ecdf9b
       TreeIter iter;
ecdf9b
       camera_model.get_iter_first (out iter);
ecdf9b
 
ecdf9b
-      // Combobox active element.
ecdf9b
-      TreeIter active_iter;
ecdf9b
-      Cheese.CameraDevice active_device;
ecdf9b
-      source_combo.get_active_iter (out active_iter);
ecdf9b
-      camera_model.get (active_iter, 1, out active_device, -1);
ecdf9b
-
ecdf9b
       // Find which device was removed.
ecdf9b
       bool device_removed = false;
ecdf9b
       devices.foreach ((device) =>
ecdf9b
@@ -508,7 +502,7 @@ public class Cheese.PreferencesDialog : GLib.Object
ecdf9b
         // Found the device that was removed.
ecdf9b
         if (strcmp (old_device.device_node, new_device.device_node) != 0)
ecdf9b
         {
ecdf9b
-            remove_camera_device (iter, new_device, active_device);
ecdf9b
+            remove_camera_device (iter, new_device);
ecdf9b
             device_removed = true;
ecdf9b
             // Remember, this is from the anonymous function!
ecdf9b
             return;
ecdf9b
@@ -521,7 +515,7 @@ public class Cheese.PreferencesDialog : GLib.Object
ecdf9b
       {
ecdf9b
         Cheese.CameraDevice old_device;
ecdf9b
         camera_model.get (iter, 1, out old_device, -1);
ecdf9b
-        remove_camera_device (iter, old_device, active_device);
ecdf9b
+        remove_camera_device (iter, old_device);
ecdf9b
       }
ecdf9b
     }
ecdf9b
   }
ecdf9b
@@ -555,16 +549,15 @@ public class Cheese.PreferencesDialog : GLib.Object
ecdf9b
    * Remove the supplied camera device from the device combo box model.
ecdf9b
    *
ecdf9b
    * @param iter the iterator of the device to remove
ecdf9b
-   * @param device_node the device to remove from the combo box model
ecdf9b
-   * @param active_device_node the currently-active camera device
ecdf9b
+   * @param device the device to remove from the combo box model
ecdf9b
    */
ecdf9b
-  private void remove_camera_device (TreeIter iter, Cheese.CameraDevice device_node,
ecdf9b
-                             Cheese.CameraDevice active_device_node)
ecdf9b
+  private void remove_camera_device (TreeIter iter,
ecdf9b
+                                     Cheese.CameraDevice device)
ecdf9b
   {
ecdf9b
       unowned GLib.PtrArray devices = camera.get_camera_devices ();
ecdf9b
 
ecdf9b
       // Check if the camera that we want to remove, is the active one
ecdf9b
-      if (strcmp (device_node.device_node, active_device_node.device_node) == 0)
ecdf9b
+      if (device.device_node == camera_device_node)
ecdf9b
       {
ecdf9b
         if (devices.len > 0)
ecdf9b
           set_new_available_camera_device (iter);
ecdf9b
-- 
ecdf9b
1.8.2.1
ecdf9b