use custom text setter on widget init

This commit is contained in:
yggverse 2024-08-27 14:56:20 +03:00
parent cc15498f7a
commit e204460e59

View File

@ -24,11 +24,9 @@ Title::Title()
WIDTH_CHARS WIDTH_CHARS
); );
set_text( set(
DEFAULT_TEXT DEFAULT_TEXT
); );
hide();
} }
Title::~Title() = default; Title::~Title() = default;
@ -37,7 +35,7 @@ void Title::set(
const Glib::ustring & TEXT const Glib::ustring & TEXT
) { ) {
set_text( set_text(
TEXT.empty() ? DEFAULT_TEXT : TEXT + " - " + DEFAULT_TEXT TEXT.empty() || TEXT == DEFAULT_TEXT ? DEFAULT_TEXT : TEXT + " - " + DEFAULT_TEXT
); );
if (get_text().empty()) hide(); else show(); if (get_text().empty()) hide(); else show();