From 5238ca38754c6b3faba376a74d0f2a9110397a92 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 2 Feb 2012 22:43:42 +0100 Subject: restore: only reprint progress bar if progress changed --- src/restore.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/restore.c b/src/restore.c index f960570..ec7d92e 100644 --- a/src/restore.c +++ b/src/restore.c @@ -360,6 +360,8 @@ const char* restore_progress_string(unsigned int operation) { } } +static int lastop = 0; + int restore_handle_progress_msg(restored_client_t client, plist_t msg) { plist_t node = NULL; uint64_t progress = 0; @@ -380,10 +382,14 @@ int restore_handle_progress_msg(restored_client_t client, plist_t msg) { plist_get_uint_val(node, &progress); if ((progress > 0) && (progress < 100)) { + if (operation != lastop) { + info("%s (%d)\n", restore_progress_string(operation), (int)operation); + } print_progress_bar((double) progress); } else { - info("%s\n", restore_progress_string(operation)); + info("%s (%d)\n", restore_progress_string(operation), (int)operation); } + lastop = operation; return 0; } -- cgit v1.1-32-gdbae