[baobab] Allow to exclude mountpoints when choosing a folder to scan
- From: Stefano Facchini <sfacchini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab] Allow to exclude mountpoints when choosing a folder to scan
- Date: Wed, 24 Jul 2013 09:41:21 +0000 (UTC)
commit f300476d68f2a9c879565818093e1f2c019599ef
Author: Stefano Facchini <stefano facchini gmail com>
Date: Wed Jul 24 00:47:07 2013 +0200
Allow to exclude mountpoints when choosing a folder to scan
src/baobab-location.vala | 4 ++--
src/baobab-window.vala | 13 +++++++++----
2 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/baobab-location.vala b/src/baobab-location.vala
index f07eefe..51ee395 100644
--- a/src/baobab-location.vala
+++ b/src/baobab-location.vala
@@ -145,7 +145,7 @@ namespace Baobab {
scanner = new Scanner (file, ScanFlags.NONE);
}
- public Location.for_file (File file_) {
+ public Location.for_file (File file_, ScanFlags flags) {
is_volume = false;
file = file_;
get_file_info ();
@@ -160,7 +160,7 @@ namespace Baobab {
get_fs_usage ();
- scanner = new Scanner (file, ScanFlags.NONE);
+ scanner = new Scanner (file, flags);
}
public void update () {
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 82fe105..8f5396e 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -231,11 +231,16 @@ namespace Baobab {
_("_Cancel"), Gtk.ResponseType.CANCEL,
_("_Open"), Gtk.ResponseType.ACCEPT);
- file_chooser.set_modal (true);
+ file_chooser.create_folders = false;
+ file_chooser.modal = true;
+
+ var check_button = new Gtk.CheckButton.with_label (_("Recursively analyze mount points"));
+ file_chooser.extra_widget = check_button;
file_chooser.response.connect ((response) => {
if (response == Gtk.ResponseType.ACCEPT) {
- scan_directory (file_chooser.get_file ());
+ var flags = check_button.active ? ScanFlags.NONE : ScanFlags.EXCLUDE_MOUNTS;
+ scan_directory (file_chooser.get_file (), flags);
}
file_chooser.destroy ();
});
@@ -607,8 +612,8 @@ namespace Baobab {
expand_first_row ();
}
- public void scan_directory (File directory) {
- var location = new Location.for_file (directory);
+ public void scan_directory (File directory, ScanFlags flags=ScanFlags.NONE) {
+ var location = new Location.for_file (directory, flags);
if (location.info == null) {
var primary = _("\"%s\" is not a valid folder").printf (directory.get_parse_name ());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]