[baobab] When monting a volume check for duplicates.
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab] When monting a volume check for duplicates.
- Date: Sat, 15 Sep 2012 19:32:12 +0000 (UTC)
commit c3837ef70b2511bbd8c7096547bec634cc1681da
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Sep 15 21:26:21 2012 +0200
When monting a volume check for duplicates.
It could be in the recent list.
src/baobab-location-list.vala | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/baobab-location-list.vala b/src/baobab-location-list.vala
index 15da410..b6bd2f6 100644
--- a/src/baobab-location-list.vala
+++ b/src/baobab-location-list.vala
@@ -60,6 +60,15 @@ namespace Baobab {
}
}
+ bool already_present (File file) {
+ foreach (var l in locations) {
+ if (l.file != null && l.file.equal (file)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
void volume_changed (Volume volume) {
update ();
}
@@ -98,7 +107,9 @@ namespace Baobab {
void mount_added (Mount mount) {
var volume = mount.get_volume ();
if (volume == null) {
- locations.append (new Location.from_mount (mount));
+ if (!already_present (mount.get_root ())) {
+ locations.append (new Location.from_mount (mount));
+ }
} else {
foreach (var location in locations) {
if (location.volume == volume) {
@@ -111,15 +122,6 @@ namespace Baobab {
update ();
}
- bool already_present (File file) {
- foreach (var l in locations) {
- if (l.file != null && l.file.equal (file)) {
- return true;
- }
- }
- return false;
- }
-
void populate () {
locations.append (new Location.for_main_volume ());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]