2 * Copyright (C) 2011 Red Hat Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 let rec disk_usage tree path =
24 let model = tree#model in
25 let row = model#get_iter path in
26 let src, pathname = tree#get_pathname row in
27 debug "disk_usage %s" pathname;
29 (* See if this node already has an Info "disk_usage" child node. If
30 * so they don't recreate it.
32 let info_text = "disk_usage" in
33 if not (tree#has_child_info_node path info_text) then (
34 tree#set_child_info_node path info_text "<i>Calculating disk usage ...</i>";
36 Slave.disk_usage src pathname (when_disk_usage tree path pathname)
39 and when_disk_usage tree path pathname kbytes =
40 let model = tree#model in
41 let row = model#get_iter path in
44 (* Find the Info "disk_usage" child node added above, and replace the
45 * text in it with the final size.
47 let info_text = "disk_usage" in
49 sprintf "<b>%s</b>\n<small>Disk usage of %s (%Ld KB)</small>"
50 (human_size_1k kbytes) pathname kbytes in
51 tree#set_child_info_node path info_text msg