(* Guestfs Browser. * Copyright (C) 2011 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) open Utils open Printf let rec checksum_file tree (path, csumtype) = let model = tree#model in let row = model#get_iter path in let src, pathname = tree#get_pathname row in debug "checksum_file %s" pathname; (* See if this node already has an Info "checksum" child * node. If so they don't recreate it. *) let info_text = "checksum:" ^ csumtype in if not (tree#has_child_info_node path info_text) then ( tree#set_child_info_node path info_text (sprintf "Calculating %s ..." csumtype); Slave.checksum_file src pathname csumtype (when_checksum_file tree path pathname csumtype) ) and when_checksum_file tree path pathname csumtype checksum = let model = tree#model in let row = model#get_iter path in tree#set_visited row; (* Find the child node added above, and replace the text. *) let info_text = "checksum:" ^ csumtype in let msg = sprintf "%s: %s" csumtype checksum in tree#set_child_info_node path info_text msg