Blame SOURCES/0033-cheese-Fix-updating-of-device-selection-combo-sensit.patch

ecdf9b
From 1b2af9add59924b46b524bd7b64bbaf12e875a57 Mon Sep 17 00:00:00 2001
ecdf9b
From: Hans de Goede <hdegoede@redhat.com>
ecdf9b
Date: Thu, 13 Jun 2013 10:30:02 +0200
ecdf9b
Subject: [PATCH 33/35] cheese: Fix updating of device selection combo
ecdf9b
 sensitivity on hotplug
ecdf9b
ecdf9b
If one started cheese with 1 device, and then added a 2nd, the device selection
ecdf9b
stayed inactive, making it impossible to select the 2nd device.
ecdf9b
ecdf9b
This fixes this, and also makes the combo go insensitive again when going from
ecdf9b
>= 2 devices to <= 1 device.
ecdf9b
ecdf9b
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
ecdf9b
---
ecdf9b
 src/cheese-preferences.vala | 9 +++++++--
ecdf9b
 1 file changed, 7 insertions(+), 2 deletions(-)
ecdf9b
ecdf9b
diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
ecdf9b
index d4d5501..e078cbb 100644
ecdf9b
--- a/src/cheese-preferences.vala
ecdf9b
+++ b/src/cheese-preferences.vala
ecdf9b
@@ -136,8 +136,7 @@ public class Cheese.PreferencesDialog : GLib.Object
ecdf9b
     camera_model = new ListStore (2, typeof (string), typeof (Cheese.CameraDevice));
ecdf9b
 
ecdf9b
     source_combo.model = camera_model;
ecdf9b
-    if (devices.len <= 1)
ecdf9b
-      source_combo.sensitive = false;
ecdf9b
+    source_combo.sensitive = false;
ecdf9b
 
ecdf9b
     devices.foreach(add_camera_device);
ecdf9b
 
ecdf9b
@@ -499,6 +498,9 @@ public class Cheese.PreferencesDialog : GLib.Object
ecdf9b
 
ecdf9b
     if (camera.get_selected_device ().get_device_node () == dev.get_device_node ())
ecdf9b
         source_combo.set_active_iter (iter);
ecdf9b
+
ecdf9b
+    if (camera_model.iter_n_children (null) > 1)
ecdf9b
+      source_combo.sensitive = true;
ecdf9b
   }
ecdf9b
 
ecdf9b
   /**
ecdf9b
@@ -522,6 +524,9 @@ public class Cheese.PreferencesDialog : GLib.Object
ecdf9b
           this.dialog.hide();
ecdf9b
       }
ecdf9b
       camera_model.remove (iter);
ecdf9b
+
ecdf9b
+      if (camera_model.iter_n_children (null) <= 1)
ecdf9b
+        source_combo.sensitive = false;
ecdf9b
   }
ecdf9b
 
ecdf9b
   /**
ecdf9b
-- 
ecdf9b
1.8.2.1
ecdf9b