[baobab] Add a timeout to regularly update disk usage information
- From: Stefano Facchini <sfacchini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab] Add a timeout to regularly update disk usage information
- Date: Sun, 29 Oct 2017 09:41:13 +0000 (UTC)
commit 9dbfb01e2da6011f5bbb32f6327bc434e057cc20
Author: Stefano Facchini <stefano facchini gmail com>
Date: Sat Oct 28 15:45:45 2017 +0200
Add a timeout to regularly update disk usage information
https://bugzilla.gnome.org/show_bug.cgi?id=776272
src/baobab-location-list.vala | 14 ++++++++++++++
src/baobab-location.vala | 6 +++++-
2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/src/baobab-location-list.vala b/src/baobab-location-list.vala
index d31eb10..63043c8 100644
--- a/src/baobab-location-list.vala
+++ b/src/baobab-location-list.vala
@@ -39,7 +39,11 @@ namespace Baobab {
public LocationRow (Location l) {
location = l;
+ update ();
+ }
+ public void update () {
+ location.get_fs_usage ();
image.gicon = location.icon;
var escaped = GLib.Markup.escape_text (location.name, -1);
@@ -111,9 +115,19 @@ namespace Baobab {
remote_list_box.set_header_func (update_header);
remote_list_box.row_activated.connect (row_activated);
+ Timeout.add_seconds(3, (() => {
+ update_existing ();
+ return Source.CONTINUE;
+ }));
+
populate ();
}
+ void update_existing () {
+ local_list_box.foreach ((widget) => { ((LocationRow)widget).update (); });
+ remote_list_box.foreach ((widget) => { ((LocationRow)widget).update (); });
+ }
+
bool already_present (File file) {
foreach (var l in locations) {
if (l.file != null && l.file.equal (file)) {
diff --git a/src/baobab-location.vala b/src/baobab-location.vala
index c14c9d8..085225d 100644
--- a/src/baobab-location.vala
+++ b/src/baobab-location.vala
@@ -200,7 +200,11 @@ namespace Baobab {
}
}
- void get_fs_usage () {
+ public void get_fs_usage () {
+ if (file == null) {
+ return;
+ }
+
size = null;
used = null;
reserved = null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]