Skip to content

Commit af72ce0

Browse files
committed
placesManager: Improve mounts
- Pretty much any mount can unmount(), what we really want to know when asking if a device is removable is if the mount.can_eject(). - Don't list mounts which are shadowed (whether or not they have a drive) - Don't list mounts which have no volumes. These are likely to be system or technical mounts (loops, overlays etc..). One example of this are docker overlays.
1 parent 9cf30b7 commit af72ce0

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

js/ui/placesManager.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ PlaceDeviceInfo.prototype = {
105105
},
106106

107107
isRemovable: function() {
108-
return this._mount.can_unmount();
108+
return this._mount.can_eject();
109109
},
110110

111111
remove: function() {
@@ -465,18 +465,6 @@ PlacesManager.prototype = {
465465
}
466466
}
467467

468-
/* add mounts that have no volume (/etc/mtab mounts, ftp, sftp,...) */
469-
let mounts = this._volumeMonitor.get_mounts();
470-
for(let i = 0; i < mounts.length; i++) {
471-
if(mounts[i].is_shadowed())
472-
continue;
473-
474-
if(mounts[i].get_volume())
475-
continue;
476-
477-
this._addMount(mounts[i]);
478-
}
479-
480468
/* We emit two signals, one for a generic 'all places' update
481469
* and the other for one specific to mounts. We do this because
482470
* clients like PlaceDisplay may only care about places in general
@@ -563,8 +551,10 @@ PlacesManager.prototype = {
563551
},
564552

565553
_addMount: function(mount) {
566-
let devItem = new PlaceDeviceInfo(mount);
567-
this._mounts.push(devItem);
554+
if(!mount.is_shadowed()) {
555+
let devItem = new PlaceDeviceInfo(mount);
556+
this._mounts.push(devItem);
557+
}
568558
},
569559

570560
getAllPlaces: function () {

0 commit comments

Comments
 (0)