[baobab] location-list: make sure to add home location only once
- From: Stefano Facchini <sfacchini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab] location-list: make sure to add home location only once
- Date: Sat, 13 Oct 2012 15:52:45 +0000 (UTC)
commit 19c3077fb4e6fab712c1853ba8e4658c03e8f38b
Author: Stefano Facchini <stefano facchini gmail com>
Date: Sat Oct 13 17:49:23 2012 +0200
location-list: make sure to add home location only once
src/baobab-location-list.vala | 10 ++++++++--
src/baobab-location.vala | 6 ++++++
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/baobab-location-list.vala b/src/baobab-location-list.vala
index 1cc0e1e..6b02aed 100644
--- a/src/baobab-location-list.vala
+++ b/src/baobab-location-list.vala
@@ -138,12 +138,18 @@ namespace Baobab {
locations.append (new Location.for_main_volume ());
foreach (var volume in monitor.get_volumes ()) {
- locations.append (new Location.from_volume (volume));
+ var location = new Location.from_volume (volume);
+ if (!location.is_home) {
+ locations.append (location);
+ }
}
foreach (var mount in monitor.get_mounts ()) {
if (mount.get_volume () == null) {
- locations.append (new Location.from_mount (mount));
+ var location = new Location.from_mount (mount);
+ if (!location.is_home) {
+ locations.append (location);
+ }
} else {
// Already added as volume
}
diff --git a/src/baobab-location.vala b/src/baobab-location.vala
index c4d6952..dac2bbe 100644
--- a/src/baobab-location.vala
+++ b/src/baobab-location.vala
@@ -43,6 +43,12 @@ namespace Baobab {
public Scanner? scanner { get; private set; }
+ public bool is_home {
+ get {
+ return home_location == this;
+ }
+ }
+
private static const string FS_ATTRIBUTES =
FileAttribute.FILESYSTEM_SIZE + "," +
FileAttribute.FILESYSTEM_USED;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]