[gnome-boxes] media-manager: Ignore non-readable devices



commit 3f972680e38ff9ded46c98ac65a9bf04ca95f718
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sun Mar 16 15:55:47 2014 +0000

    media-manager: Ignore non-readable devices
    
    If user doesn't have permissions to use the device, there is no point in
    presenting it to user only to error out after user sets-up a box for it.

 src/media-manager.vala |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/media-manager.vala b/src/media-manager.vala
index 7f73618..a89f152 100644
--- a/src/media-manager.vala
+++ b/src/media-manager.vala
@@ -100,7 +100,17 @@ private class Boxes.MediaManager : Object {
                 continue;
 
             var path = device.get_device_file ();
+            var file = File.new_for_path (path);
             try {
+                var info = yield file.query_info_async (FileAttribute.ACCESS_CAN_READ,
+                                                        FileQueryInfoFlags.NONE,
+                                                        Priority.DEFAULT,
+                                                        null);
+                if (!info.get_attribute_boolean (FileAttribute.ACCESS_CAN_READ)) {
+                    debug ("No read access to '%s', ignoring..", path);
+                    continue;
+                }
+
                 var media = yield create_installer_media_for_path (path);
 
                 list.append (media);


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