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 checksum_file tree (path, csumtype) =
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 "checksum_file %s" pathname;
29 (* See if this node already has an Info "checksum" child
30 * node. If so they don't recreate it.
32 let info_text = "checksum:" ^ csumtype in
33 if not (tree#has_child_info_node path info_text) then (
34 tree#set_child_info_node path info_text
35 (sprintf "<i>Calculating %s ...</i>" csumtype);
37 Slave.checksum_file src pathname csumtype
38 (when_checksum_file tree path pathname csumtype)
41 and when_checksum_file tree path pathname csumtype checksum =
42 let model = tree#model in
43 let row = model#get_iter path in
46 (* Find the child node added above, and replace the text. *)
47 let info_text = "checksum:" ^ csumtype in
48 let msg = sprintf "%s: %s" csumtype checksum in
49 tree#set_child_info_node path info_text msg