[ekiga/ds-gsettings3] Prefs: Handle safely the case where no device is found.



commit d8cce37be9713682c66348fe0159d32a8d17c4a9
Author: Damien Sandras <dsandras beip be>
Date:   Sun Dec 8 18:39:46 2013 +0100

    Prefs: Handle safely the case where no device is found.
    
    The core will fallback to a sane fallback device.
    However, the UI should make it clear that no device was found.

 lib/engine/gui/gtk-frontend/preferences-window.cpp |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/preferences-window.cpp 
b/lib/engine/gui/gtk-frontend/preferences-window.cpp
index 0a838c2..1559be1 100644
--- a/lib/engine/gui/gtk-frontend/preferences-window.cpp
+++ b/lib/engine/gui/gtk-frontend/preferences-window.cpp
@@ -1494,9 +1494,11 @@ gm_pw_get_device_choices (const std::vector<std::string> & v)
 {
   Choices c;
 
-  for (std::vector<std::string>::const_iterator iter = v.begin ();
-       iter != v.end ();
-       ++iter)
+  if (v.size () == 0)
+    c.push_back (boost::make_tuple ("none", _("No device found")));
+  else for (std::vector<std::string>::const_iterator iter = v.begin ();
+            iter != v.end ();
+            ++iter)
     c.push_back (boost::make_tuple (*iter, *iter));
 
   return c;


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