[shotwell] Fix unmounting devices on MTP conflict



commit 4d4041a133a029bfb123fd48f641cbe6acbad5a6
Author: Jens Georg <mail jensge org>
Date:   Wed Nov 8 15:34:35 2017 +0100

    Fix unmounting devices on MTP conflict
    
    Apparently there are devices that are occupied bz the MTP volume
    monitor. Fix unmounting those cameras as well
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786821

 src/camera/ImportPage.vala |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/camera/ImportPage.vala b/src/camera/ImportPage.vala
index 18dea09..f7698a6 100644
--- a/src/camera/ImportPage.vala
+++ b/src/camera/ImportPage.vala
@@ -1008,6 +1008,17 @@ public class ImportPage : CheckerboardPage {
                 } catch (Error err) {
                     // error means not mounted
                 }
+
+                // Could not find mount for gphoto2://, re-try with mtp://
+                // It seems some devices are mounted using MTP and not gphoto2 daemon
+                if (mount == null && this.uri.has_prefix("gphoto2")) {
+                    uri = File.new_for_uri("mtp" + this.uri.substring(7));
+                    try {
+                        mount = uri.find_enclosing_mount(null);
+                    } catch (Error err) {
+                        // error means not mounted
+                    }
+                }
                 
                 if (mount != null) {
                     // it's mounted, offer to unmount for the user
@@ -1171,7 +1182,7 @@ public class ImportPage : CheckerboardPage {
                 });
                 claim_timeout *= 2;
 
-                return RefreshResult.BUSY;
+                return RefreshResult.LOCKED;
             }
         }
 


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