From 7006f22f2fb32083f064987e3622df7fbd2b0faa Mon Sep 17 00:00:00 2001 From: Lutz Mueller Date: Sat, 29 Dec 2001 08:49:02 +0000 Subject: [PATCH] =?UTF-8?q?2001-12-29=20=20Lutz=20M=EF=BF=BDller=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * frontends/command-line/main.c: Show file-specific progress on upload, too. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@3607 67ed7778-7388-44ab-90cf-0a291f65f57c --- ChangeLog | 5 +++++ frontends/command-line/main.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/ChangeLog b/ChangeLog index be20054d3..1f708e130 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-12-29 Lutz Müller + + * frontends/command-line/main.c: Show file-specific progress on + upload, too. + 2001-12-29 Lutz Müller * libgphoto2/gphoto2-camera.h: Add a note about diff --git a/frontends/command-line/main.c b/frontends/command-line/main.c index f7c8e14fc..30ee2245a 100644 --- a/frontends/command-line/main.c +++ b/frontends/command-line/main.c @@ -903,6 +903,24 @@ OPTION_CALLBACK (delete_all_pictures) return (GP_OK); } +static int +upload_progress_func (CameraFile *file, float percentage, void *data) +{ + const char *name; + + if (glob_quiet) + return (GP_OK); + + CHECK_RESULT (gp_file_get_name (file, &name)); + if (strlen (name)) + printf ("Uploading '%s': %02.01f\r", name, percentage * 100.); + else + printf ("Uploading: %02.01f\r", percentage * 100.); + fflush (stdout); + + return (GP_OK); +} + OPTION_CALLBACK (upload_picture) { CameraFile *file; @@ -919,7 +937,9 @@ OPTION_CALLBACK (upload_picture) return (res); } + gp_file_set_progress_func (file, upload_progress_func, NULL); res = gp_camera_folder_put_file (glob_camera, glob_folder, file); + gp_file_set_progress_func (file, NULL, NULL); gp_file_unref (file); return (res);