[baobab] Check for duplicates before adding a volume



commit 8c873274088eea0b7b1b104fd72dd936b6cc4429
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Wed Oct 3 12:21:27 2012 +0200

    Check for duplicates before adding a volume
    
    Since GVolumeMonitor unnecessarly fires "volume-added" signals
    at startup (see bugzilla bug 684677) we need to workaround and
    check for duplicates, until a fixed version of gvfs is released.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685198

 src/baobab-location-list.vala |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/baobab-location-list.vala b/src/baobab-location-list.vala
index dc23018..109f423 100644
--- a/src/baobab-location-list.vala
+++ b/src/baobab-location-list.vala
@@ -89,7 +89,16 @@ namespace Baobab {
         }
 
         void volume_added (Volume volume) {
+            // Since GVolumeMonitor unnecessarly fires "volume-added" signals
+            // at startup (see bugzilla bug 684677) we need to workaround and
+            // check for duplicates, until a fixed version of gvfs is released.
+            foreach (var location in locations) {
+                if (location.volume == volume) {
+                    return;
+                }
+            }
             append_to_volumes (new Location.from_volume (volume));
+
             update ();
         }
 



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