diff options
author | Stefano Facchini <stefano.facchini@gmail.com> | 2017-10-28 15:45:45 +0200 |
---|---|---|
committer | Stefano Facchini <stefano.facchini@gmail.com> | 2017-10-29 10:37:34 +0100 |
commit | 9dbfb01e2da6011f5bbb32f6327bc434e057cc20 (patch) | |
tree | 818a3e47ee3ac032a3d5ac563937bc56bf560cb3 | |
parent | e5ce45c61173c7ca243ed8196e06655078fb260d (diff) | |
download | baobab-9dbfb01e2da6011f5bbb32f6327bc434e057cc20.tar.gz |
Add a timeout to regularly update disk usage information
https://bugzilla.gnome.org/show_bug.cgi?id=776272
-rw-r--r-- | src/baobab-location-list.vala | 14 | ||||
-rw-r--r-- | 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; |