Don't create an empty string in WLabel objects.

* (simple_status_msg_init_cb): pass NULL instead of "" to label_new()
    to get rid of an empty string duplication.
  * (advanced_chown_dlg_create): likewise.
  * (chown_dlg_create): likewise.
  * (dirsize_status_init_cb): likewise.
  * (file_op_context_create_ui): likewise.
  * (setup_gui): likewise.
  * (init_hotlist): likewise.
  * (init_learn): likewise.
  * (file_progress_show_source): pass NULL instead of "" to
    label_set_text() to get rid of an empty string duplication.
  * (file_progress_show_target): likewise.
  * (create_file_manager): pass NULL instead of 0 to label_new().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2023-02-23 11:37:32 +03:00
parent e472f23c13
commit c5466cd494
9 changed files with 23 additions and 23 deletions

View File

@ -712,7 +712,7 @@ simple_status_msg_init_cb (status_msg_t * sm)
wd_width = MAX (wd->rect.cols, b_width + 6);
y = 2;
ssm->label = label_new (y++, 3, "");
ssm->label = label_new (y++, 3, NULL);
group_add_widget_autopos (wg, ssm->label, WPOS_KEEP_TOP | WPOS_CENTER_HORZ, NULL);
group_add_widget (wg, hline_new (y++, -1, -1));
b = WIDGET (button_new (y++, 3, B_CANCEL, NORMAL_BUTTON, b_name, NULL));

View File

@ -753,7 +753,7 @@ advanced_chown_dlg_create (WPanel * panel)
/* draw background */
ch_dlg->bg->callback = advanced_chown_bg_callback;
l_filename = label_new (2, 3, "");
l_filename = label_new (2, 3, NULL);
group_add_widget (ch_grp, l_filename);
group_add_widget (ch_grp, hline_new (3, -1, -1));
@ -772,7 +772,7 @@ advanced_chown_dlg_create (WPanel * panel)
b_group = button_new (XTRACT (4, BY, user_group_button_cb));
advanced_chown_but[4].id = group_add_widget (ch_grp, b_group);
l_mode = label_new (BY + 2, 3, "");
l_mode = label_new (BY + 2, 3, NULL);
group_add_widget (ch_grp, l_mode);
y = BY + 3;

View File

@ -234,7 +234,7 @@ chown_dlg_create (WPanel * panel)
/* add widgets for the file information */
for (i = 0; i < LABELS; i++)
{
chown_label[i].l = label_new (chown_label[i].y, 7 + GW * 2, "");
chown_label[i].l = label_new (chown_label[i].y, 7 + GW * 2, NULL);
group_add_widget (g, chown_label[i].l);
}

View File

@ -3181,9 +3181,9 @@ dirsize_status_init_cb (status_msg_t * sm)
b_width += str_term_width1 (b2_name) + 4 + 1;
ui_width = MAX (COLS / 2, b_width + 6);
dsm->dirname = label_new (2, 3, "");
dsm->dirname = label_new (2, 3, NULL);
group_add_widget (gd, dsm->dirname);
dsm->count_size = label_new (3, 3, "");
dsm->count_size = label_new (3, 3, NULL);
group_add_widget (gd, dsm->count_size);
group_add_widget (gd, hline_new (4, -1, -1));

View File

@ -859,16 +859,16 @@ file_op_context_create_ui (file_op_context_t * ctx, gboolean with_eta,
ui->showing_eta = with_eta && ctx->progress_totals_computed;
ui->showing_bps = with_eta;
ui->src_file_label = label_new (y++, x, "");
ui->src_file_label = label_new (y++, x, NULL);
group_add_widget (g, ui->src_file_label);
ui->src_file = label_new (y++, x, "");
ui->src_file = label_new (y++, x, NULL);
group_add_widget (g, ui->src_file);
ui->tgt_file_label = label_new (y++, x, "");
ui->tgt_file_label = label_new (y++, x, NULL);
group_add_widget (g, ui->tgt_file_label);
ui->tgt_file = label_new (y++, x, "");
ui->tgt_file = label_new (y++, x, NULL);
group_add_widget (g, ui->tgt_file);
ui->progress_file_gauge = gauge_new (y++, x + 3, dlg_width - (x + 3) * 2, FALSE, 100, 0);
@ -876,7 +876,7 @@ file_op_context_create_ui (file_op_context_t * ctx, gboolean with_eta,
ui->progress_file_gauge->from_left_to_right = FALSE;
group_add_widget_autopos (g, ui->progress_file_gauge, WPOS_KEEP_TOP | WPOS_KEEP_HORZ, NULL);
ui->progress_file_label = label_new (y++, x, "");
ui->progress_file_label = label_new (y++, x, NULL);
group_add_widget (g, ui->progress_file_label);
if (verbose && dialog_type == FILEGUI_DIALOG_MULTI_ITEM)
@ -894,19 +894,19 @@ file_op_context_create_ui (file_op_context_t * ctx, gboolean with_eta,
WPOS_KEEP_TOP | WPOS_KEEP_HORZ, NULL);
}
ui->total_files_processed_label = label_new (y++, x, "");
ui->total_files_processed_label = label_new (y++, x, NULL);
group_add_widget (g, ui->total_files_processed_label);
ui->time_label = label_new (y++, x, "");
ui->time_label = label_new (y++, x, NULL);
group_add_widget (g, ui->time_label);
}
}
else
{
ui->src_file = label_new (y++, x, "");
ui->src_file = label_new (y++, x, NULL);
group_add_widget (g, ui->src_file);
ui->total_files_processed_label = label_new (y++, x, "");
ui->total_files_processed_label = label_new (y++, x, NULL);
group_add_widget (g, ui->total_files_processed_label);
}
@ -1150,8 +1150,8 @@ file_progress_show_source (file_op_context_t * ctx, const vfs_path_t * vpath)
}
else
{
label_set_text (ui->src_file_label, "");
label_set_text (ui->src_file, "");
label_set_text (ui->src_file_label, NULL);
label_set_text (ui->src_file, NULL);
}
}
@ -1174,8 +1174,8 @@ file_progress_show_target (file_op_context_t * ctx, const vfs_path_t * vpath)
}
else
{
label_set_text (ui->tgt_file_label, "");
label_set_text (ui->tgt_file, "");
label_set_text (ui->tgt_file_label, NULL);
label_set_text (ui->tgt_file, NULL);
}
}

View File

@ -918,7 +918,7 @@ create_file_manager (void)
group_add_widget (g, get_panel_widget (0));
group_add_widget (g, get_panel_widget (1));
the_hint = label_new (0, 0, 0);
the_hint = label_new (0, 0, NULL);
the_hint->transparent = TRUE;
the_hint->auto_adjust_cols = 0;
WIDGET (the_hint)->rect.cols = COLS;

View File

@ -1709,7 +1709,7 @@ setup_gui (void)
group_add_widget_autopos (g, hline_new (y++, -1, -1), WPOS_KEEP_BOTTOM, NULL);
found_num_label = label_new (y++, 4, "");
found_num_label = label_new (y++, 4, NULL);
group_add_widget_autopos (g, found_num_label, WPOS_KEEP_BOTTOM, NULL);
status_label = label_new (y++, 4, _("Searching"));

View File

@ -813,7 +813,7 @@ init_hotlist (hotlist_t list_type)
path_box = groupbox_new (y, UX, 3, hotlist_widget->rect.cols, _("Directory path"));
group_add_widget_autopos (g, path_box, WPOS_KEEP_BOTTOM | WPOS_KEEP_HORZ, NULL);
pname = label_new (y + 1, UX + 2, "");
pname = label_new (y + 1, UX + 2, NULL);
group_add_widget_autopos (g, pname, WPOS_KEEP_BOTTOM | WPOS_KEEP_LEFT, NULL);
y += WIDGET (path_box)->rect.lines;

View File

@ -310,7 +310,7 @@ init_learn (void)
learnkeys[i].button =
WIDGET (button_new (y, x, B_USER + i, NARROW_BUTTON, buffer, learn_button));
learnkeys[i].label = WIDGET (label_new (y, x + 19, ""));
learnkeys[i].label = WIDGET (label_new (y, x + 19, NULL));
group_add_widget (g, learnkeys[i].button);
group_add_widget (g, learnkeys[i].label);