Also display the total amount copied
This commit is contained in:
parent
92056461e5
commit
227c4f4621
24
src/copy.c
24
src/copy.c
|
@ -271,7 +271,8 @@ static int _single_symlink(Copy * copy, char const * src, char const * dst);
|
||||||
static int _single_regular(Copy * copy, char const * src, char const * dst);
|
static int _single_regular(Copy * copy, char const * src, char const * dst);
|
||||||
static int _single_p(Copy * copy, char const * dst, struct stat const * st);
|
static int _single_p(Copy * copy, char const * dst, struct stat const * st);
|
||||||
static gboolean _single_timeout(gpointer data);
|
static gboolean _single_timeout(gpointer data);
|
||||||
static void _single_unit(guint64 size, double * fraction, char const ** unit);
|
static void _single_unit(guint64 size, double * fraction, char const ** unit,
|
||||||
|
double * current);
|
||||||
|
|
||||||
static int _copy_single(Copy * copy, char const * src, char const * dst)
|
static int _copy_single(Copy * copy, char const * src, char const * dst)
|
||||||
{
|
{
|
||||||
|
@ -595,6 +596,7 @@ static gboolean _single_timeout(gpointer data)
|
||||||
char const * rate_unit;
|
char const * rate_unit;
|
||||||
double total_fraction;
|
double total_fraction;
|
||||||
char const * total_unit;
|
char const * total_unit;
|
||||||
|
double current_fraction;
|
||||||
|
|
||||||
if(copy->fpulse == 1)
|
if(copy->fpulse == 1)
|
||||||
{
|
{
|
||||||
|
@ -617,15 +619,19 @@ static gboolean _single_timeout(gpointer data)
|
||||||
}
|
}
|
||||||
_single_unit((copy->cnt * 1024)
|
_single_unit((copy->cnt * 1024)
|
||||||
/ ((tv.tv_sec * 1000) + (tv.tv_usec / 1000)),
|
/ ((tv.tv_sec * 1000) + (tv.tv_usec / 1000)),
|
||||||
&rate_fraction, &rate_unit);
|
&rate_fraction, &rate_unit, NULL);
|
||||||
_single_unit(copy->cnt, &total_fraction, &total_unit);
|
current_fraction = copy->cnt;
|
||||||
snprintf(buf, sizeof(buf), "%.1f %s (%.1f %s/s)", total_fraction,
|
_single_unit(copy->size, &total_fraction, &total_unit,
|
||||||
total_unit, rate_fraction, rate_unit);
|
¤t_fraction);
|
||||||
|
snprintf(buf, sizeof(buf), _("%.1f of %.1f %s (%.1f %s/s)"),
|
||||||
|
current_fraction, total_fraction, total_unit,
|
||||||
|
rate_fraction, rate_unit);
|
||||||
gtk_label_set_text(GTK_LABEL(copy->fspeed), buf);
|
gtk_label_set_text(GTK_LABEL(copy->fspeed), buf);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _single_unit(guint64 size, double * fraction, char const ** unit)
|
static void _single_unit(guint64 size, double * fraction, char const ** unit,
|
||||||
|
double * current)
|
||||||
{
|
{
|
||||||
/* bytes */
|
/* bytes */
|
||||||
*fraction = size;
|
*fraction = size;
|
||||||
|
@ -634,16 +640,22 @@ static void _single_unit(guint64 size, double * fraction, char const ** unit)
|
||||||
return;
|
return;
|
||||||
/* kilobytes */
|
/* kilobytes */
|
||||||
*fraction /= 1024;
|
*fraction /= 1024;
|
||||||
|
if(current)
|
||||||
|
*current /= 1024;
|
||||||
*unit = _("kB");
|
*unit = _("kB");
|
||||||
if(*fraction < 1024)
|
if(*fraction < 1024)
|
||||||
return;
|
return;
|
||||||
/* megabytes */
|
/* megabytes */
|
||||||
*fraction /= 1024;
|
*fraction /= 1024;
|
||||||
|
if(current)
|
||||||
|
*current /= 1024;
|
||||||
*unit = _("MB");
|
*unit = _("MB");
|
||||||
if(*fraction < 1024)
|
if(*fraction < 1024)
|
||||||
return;
|
return;
|
||||||
/* gigabytes */
|
/* gigabytes */
|
||||||
*fraction /= 1024;
|
*fraction /= 1024;
|
||||||
|
if(current)
|
||||||
|
*current /= 1024;
|
||||||
*unit = _("GB");
|
*unit = _("GB");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user