mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-01 00:54:24 +03:00
Refactoring: use label_set_textv() where reasonable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
562889ce1e
commit
d35f0c68dc
@ -305,11 +305,8 @@ advanced_chown_refresh (WDialog * h)
|
||||
static void
|
||||
advanced_chown_info_update (void)
|
||||
{
|
||||
char buffer[BUF_SMALL];
|
||||
|
||||
/* mode */
|
||||
g_snprintf (buffer, sizeof (buffer), "Permissions (octal): %o", get_mode ());
|
||||
label_set_text (l_mode, buffer);
|
||||
label_set_textv (l_mode, _("Permissions (octal): %o"), get_mode ());
|
||||
|
||||
/* permissions */
|
||||
update_permissions ();
|
||||
@ -1011,7 +1008,6 @@ advanced_chown_cmd (void)
|
||||
const char *fname;
|
||||
int result;
|
||||
int file_idx;
|
||||
char buffer[BUF_MEDIUM];
|
||||
|
||||
do_refresh ();
|
||||
|
||||
@ -1036,10 +1032,9 @@ advanced_chown_cmd (void)
|
||||
ch_dlg = advanced_chown_dlg_create ();
|
||||
|
||||
file_idx = files_on_begin == 1 ? 1 : (files_on_begin - current_panel->marked + 1);
|
||||
g_snprintf (buffer, sizeof (buffer), "%s (%d/%d)",
|
||||
str_fit_to_term (fname, WIDGET (ch_dlg)->cols - 20, J_LEFT_FIT),
|
||||
file_idx, files_on_begin);
|
||||
label_set_text (l_filename, buffer);
|
||||
label_set_textv (l_filename, "%s (%d/%d)",
|
||||
str_fit_to_term (fname, WIDGET (ch_dlg)->cols - 20, J_LEFT_FIT),
|
||||
file_idx, files_on_begin);
|
||||
update_ownership ();
|
||||
|
||||
result = dlg_run (ch_dlg);
|
||||
|
@ -263,11 +263,8 @@ chmod_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
|
||||
|
||||
if (i < BUTTONS_PERM)
|
||||
{
|
||||
char buffer[BUF_TINY];
|
||||
|
||||
ch_mode ^= check_perm[i].mode;
|
||||
g_snprintf (buffer, sizeof (buffer), "%o", (unsigned int) ch_mode);
|
||||
label_set_text (statl, buffer);
|
||||
label_set_textv (statl, "%o", (unsigned int) ch_mode);
|
||||
chmod_toggle_select (h, i);
|
||||
mode_change = TRUE;
|
||||
return MSG_HANDLED;
|
||||
|
@ -964,7 +964,6 @@ file_progress_show (file_op_context_t * ctx, off_t done, off_t total,
|
||||
const char *stalled_msg, gboolean force_update)
|
||||
{
|
||||
file_op_context_ui_t *ui;
|
||||
char buffer[BUF_TINY];
|
||||
|
||||
if (!verbose || ctx == NULL || ctx->ui == NULL)
|
||||
return;
|
||||
@ -983,25 +982,24 @@ file_progress_show (file_op_context_t * ctx, off_t done, off_t total,
|
||||
if (!force_update)
|
||||
return;
|
||||
|
||||
if (ui->showing_eta && ctx->eta_secs > 0.5)
|
||||
if (!ui->showing_eta || ctx->eta_secs <= 0.5)
|
||||
label_set_text (ui->progress_file_label, stalled_msg);
|
||||
else
|
||||
{
|
||||
char buffer2[BUF_TINY];
|
||||
|
||||
file_eta_prepare_for_show (buffer2, ctx->eta_secs, FALSE);
|
||||
if (ctx->bps == 0)
|
||||
g_snprintf (buffer, sizeof (buffer), "%s %s", buffer2, stalled_msg);
|
||||
label_set_textv (ui->progress_file_label, "%s %s", buffer2, stalled_msg);
|
||||
else
|
||||
{
|
||||
char buffer3[BUF_TINY];
|
||||
|
||||
file_bps_prepare_for_show (buffer3, ctx->bps);
|
||||
g_snprintf (buffer, sizeof (buffer), "%s (%s) %s", buffer2, buffer3, stalled_msg);
|
||||
label_set_textv (ui->progress_file_label, "%s (%s) %s", buffer2, buffer3, stalled_msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
g_snprintf (buffer, sizeof (buffer), "%s", stalled_msg);
|
||||
|
||||
label_set_text (ui->progress_file_label, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -1009,7 +1007,6 @@ file_progress_show (file_op_context_t * ctx, off_t done, off_t total,
|
||||
void
|
||||
file_progress_show_count (file_op_context_t * ctx, size_t done, size_t total)
|
||||
{
|
||||
char buffer[BUF_TINY];
|
||||
file_op_context_ui_t *ui;
|
||||
|
||||
if (ctx == NULL || ctx->ui == NULL)
|
||||
@ -1021,10 +1018,10 @@ file_progress_show_count (file_op_context_t * ctx, size_t done, size_t total)
|
||||
return;
|
||||
|
||||
if (ctx->progress_totals_computed)
|
||||
g_snprintf (buffer, sizeof (buffer), _("Files processed: %zu/%zu"), done, total);
|
||||
label_set_textv (ui->total_files_processed_label, _("Files processed: %zu/%zu"), done,
|
||||
total);
|
||||
else
|
||||
g_snprintf (buffer, sizeof (buffer), _("Files processed: %zu"), done);
|
||||
label_set_text (ui->total_files_processed_label, buffer);
|
||||
label_set_textv (ui->total_files_processed_label, _("Files processed: %zu"), done);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -1033,7 +1030,6 @@ void
|
||||
file_progress_show_total (file_op_total_context_t * tctx, file_op_context_t * ctx,
|
||||
uintmax_t copied_bytes, gboolean show_summary)
|
||||
{
|
||||
char buffer[BUF_TINY];
|
||||
char buffer2[BUF_TINY];
|
||||
char buffer3[BUF_TINY];
|
||||
file_op_context_ui_t *ui;
|
||||
@ -1070,30 +1066,29 @@ file_progress_show_total (file_op_total_context_t * tctx, file_op_context_t * ct
|
||||
{
|
||||
file_eta_prepare_for_show (buffer3, tctx->eta_secs, TRUE);
|
||||
if (tctx->bps == 0)
|
||||
g_snprintf (buffer, sizeof (buffer), _("Time: %s %s"), buffer2, buffer3);
|
||||
label_set_textv (ui->time_label, _("Time: %s %s"), buffer2, buffer3);
|
||||
else
|
||||
{
|
||||
file_bps_prepare_for_show (buffer4, (long) tctx->bps);
|
||||
g_snprintf (buffer, sizeof (buffer), _("Time: %s %s (%s)"), buffer2, buffer3,
|
||||
buffer4);
|
||||
label_set_textv (ui->time_label, _("Time: %s %s (%s)"), buffer2, buffer3, buffer4);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tctx->bps == 0)
|
||||
g_snprintf (buffer, sizeof (buffer), _("Time: %s"), buffer2);
|
||||
label_set_textv (ui->time_label, _("Time: %s"), buffer2);
|
||||
else
|
||||
{
|
||||
file_bps_prepare_for_show (buffer4, (long) tctx->bps);
|
||||
g_snprintf (buffer, sizeof (buffer), _("Time: %s (%s)"), buffer2, buffer4);
|
||||
label_set_textv (ui->time_label, _("Time: %s (%s)"), buffer2, buffer4);
|
||||
}
|
||||
}
|
||||
|
||||
label_set_text (ui->time_label, buffer);
|
||||
}
|
||||
|
||||
if (ui->total_bytes_label != NULL)
|
||||
{
|
||||
char buffer[BUF_TINY];
|
||||
|
||||
size_trunc_len (buffer2, 5, tctx->copied_bytes, 0, panels_options.kilobyte_si);
|
||||
|
||||
if (!ctx->progress_totals_computed)
|
||||
|
@ -365,13 +365,10 @@ status_update (const char *text)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
static inline void
|
||||
found_num_update (void)
|
||||
{
|
||||
char buffer[BUF_TINY];
|
||||
|
||||
g_snprintf (buffer, sizeof (buffer), _("Found: %lu"), matches);
|
||||
label_set_text (found_num_label, buffer);
|
||||
label_set_textv (found_num_label, _("Found: %lu"), matches);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
Loading…
Reference in New Issue
Block a user