[cheese/wip/hans-fixes: 33/35] cheese: Fix updating of device	selection combo sensitivity on hotplug
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [cheese/wip/hans-fixes: 33/35] cheese: Fix updating of device	selection combo sensitivity on hotplug
- Date: Fri, 14 Jun 2013 22:26:27 +0000 (UTC)
commit ca26f7d543e7a6f2f0058d01680997e3714d5c71
Author: Hans de Goede <hdegoede redhat com>
Date:   Thu Jun 13 10:30:02 2013 +0200
    cheese: Fix updating of device selection combo sensitivity on hotplug
    
    If one started cheese with 1 device, and then added a 2nd, the device selection
    stayed inactive, making it impossible to select the 2nd device.
    
    This fixes this, and also makes the combo go insensitive again when going from
    >= 2 devices to <= 1 device.
    
    Signed-off-by: Hans de Goede <hdegoede redhat com>
 src/cheese-preferences.vala |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
index d4d5501..e078cbb 100644
--- a/src/cheese-preferences.vala
+++ b/src/cheese-preferences.vala
@@ -136,8 +136,7 @@ public class Cheese.PreferencesDialog : GLib.Object
     camera_model = new ListStore (2, typeof (string), typeof (Cheese.CameraDevice));
 
     source_combo.model = camera_model;
-    if (devices.len <= 1)
-      source_combo.sensitive = false;
+    source_combo.sensitive = false;
 
     devices.foreach(add_camera_device);
 
@@ -499,6 +498,9 @@ public class Cheese.PreferencesDialog : GLib.Object
 
     if (camera.get_selected_device ().get_device_node () == dev.get_device_node ())
         source_combo.set_active_iter (iter);
+
+    if (camera_model.iter_n_children (null) > 1)
+      source_combo.sensitive = true;
   }
 
   /**
@@ -522,6 +524,9 @@ public class Cheese.PreferencesDialog : GLib.Object
           this.dialog.hide();
       }
       camera_model.remove (iter);
+
+      if (camera_model.iter_n_children (null) <= 1)
+        source_combo.sensitive = false;
   }
 
   /**
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]