[baobab] Update volume information when it is mounted



commit 856ea33b822d940a956262c78b0096bdcd8f8b85
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Wed Apr 25 23:21:25 2012 +0200

    Update volume information when it is mounted

 src/baobab-location-monitor.vala |   12 ++++++++++--
 src/baobab-location.vala         |    4 ++++
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/baobab-location-monitor.vala b/src/baobab-location-monitor.vala
index 47c45e1..4246a99 100644
--- a/src/baobab-location-monitor.vala
+++ b/src/baobab-location-monitor.vala
@@ -89,8 +89,16 @@ namespace Baobab {
         }
 
         void mount_added (Mount mount) {
-            if (mount.get_volume () == null) {
-                locations.append (new Location.from_mount (mount));
+            var volume = mount.get_volume ();
+            if (volume == null) {
+                 locations.append (new Location.from_mount (mount));
+            } else {
+                foreach (var location in locations) {
+                    if (location.volume == volume) {
+                        location.update ();
+                        break;
+                    }
+                }
             }
 
             changed ();
diff --git a/src/baobab-location.vala b/src/baobab-location.vala
index 8b55204..9f95fd6 100644
--- a/src/baobab-location.vala
+++ b/src/baobab-location.vala
@@ -76,6 +76,10 @@ namespace Baobab {
             get_fs_usage (File.new_for_path (mount_point));
         }
 
+        public void update () {
+            update_volume_info ();
+        }
+
         void make_this_home_location () {
             name = _("Home folder");
             icon = new ThemedIcon ("user-home");



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