[baobab] Distinguish volume locations from dir locations



commit 9d80e40db7939f9ff4197418d55b4ac6a19b72ac
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Jul 28 12:48:53 2012 +0200

    Distinguish volume locations from dir locations
    
    Do not just special case the home dir, but treat all dirs consistently
    (e.g. with regard to the flags used for the scan)

 src/baobab-location.vala |   10 ++++------
 src/baobab-window.vala   |    6 +++---
 2 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/src/baobab-location.vala b/src/baobab-location.vala
index f53c8e9..db126c6 100644
--- a/src/baobab-location.vala
+++ b/src/baobab-location.vala
@@ -1,6 +1,7 @@
 /* -*- indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* Baobab - disk usage analyzer
  *
+ * Copyright (C) 2012  Paolo Borelli <pborelli gnome org>
  * Copyright (C) 2012  Stefano Facchini <stefano facchini gmail com>
  *
  * This program is free software; you can redistribute it and/or
@@ -23,6 +24,7 @@ namespace Baobab {
     public class Location {
         public string name { get; private set; }
         public string? mount_point { get; private set; }
+        public bool is_volume { get; private set; default = true; }
 
         public uint64? size { get; private set; }
         public uint64? used { get; private set; }
@@ -39,6 +41,7 @@ namespace Baobab {
         private static Location? home_location = null;
 
         Location.for_home_folder () {
+            is_volume = false;
             mount_point = Environment.get_home_dir ();
             make_this_home_location ();
 
@@ -53,12 +56,6 @@ namespace Baobab {
             return home_location;
         }
 
-        public bool is_home_location {
-            get {
-                return (this == home_location);
-            }
-        }
-
         public Location.from_volume (Volume volume_) {
             volume = volume_;
             volume.changed.connect((vol) => {
@@ -81,6 +78,7 @@ namespace Baobab {
         }
 
         public Location.for_recent_info (Gtk.RecentInfo info) {
+            is_volume = false; // we assume recent locations are just folders
             name = info.get_display_name ();
             mount_point = info.get_uri_display ();
             icon = info.get_gicon ();
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 0c6eeea..d01af47 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -226,9 +226,7 @@ namespace Baobab {
         }
 
         void on_scan_location_activate (Location location) {
-            if (location.is_home_location) {
-                on_scan_home_activate ();
-            } else {
+            if (location.is_volume) {
                 location.mount_volume.begin ((location_, res) => {
                     try {
                         location.mount_volume.end (res);
@@ -237,6 +235,8 @@ namespace Baobab {
                         message (_("Could not analyze volume."), e.message, Gtk.MessageType.ERROR);
                     }
                 });
+            } else {
+                scan_directory (File.new_for_path (location.mount_point));
             }
         }
 



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