From 336be96af6b5b60eb6d3e1f1fc1a95d0c11ea942 Mon Sep 17 00:00:00 2001
From: "Zeeshan Ali (Khattak)" <zeeshanak@gnome.org>
Date: Sun, 16 Mar 2014 15:55:47 +0000
Subject: [PATCH 3/3] 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 file changed, 10 insertions(+)
diff --git a/src/media-manager.vala b/src/media-manager.vala
index a27d958..8bde954 100644
--- a/src/media-manager.vala
+++ b/src/media-manager.vala
@@ -83,7 +83,17 @@ public async InstallerMedia create_installer_media_for_path (string path,
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);
--
1.8.5.3