Browse Source

hide widget on empty value

CPP-GTK4
yggverse 3 months ago
parent
commit
cc15498f7a
  1. 5
      src/app/browser/header/main/subtitle.cpp
  2. 4
      src/app/browser/header/main/title.cpp

5
src/app/browser/header/main/subtitle.cpp

@ -23,6 +23,8 @@ Subtitle::Subtitle()
set_width_chars( set_width_chars(
WIDTH_CHARS WIDTH_CHARS
); );
hide();
} }
Subtitle::~Subtitle() = default; Subtitle::~Subtitle() = default;
@ -30,7 +32,10 @@ Subtitle::~Subtitle() = default;
void Subtitle::set( void Subtitle::set(
const Glib::ustring & TEXT const Glib::ustring & TEXT
) { ) {
set_text( set_text(
TEXT TEXT
); );
if (get_text().empty()) hide(); else show();
} }

4
src/app/browser/header/main/title.cpp

@ -27,6 +27,8 @@ Title::Title()
set_text( set_text(
DEFAULT_TEXT DEFAULT_TEXT
); );
hide();
} }
Title::~Title() = default; Title::~Title() = default;
@ -37,4 +39,6 @@ void Title::set(
set_text( set_text(
TEXT.empty() ? DEFAULT_TEXT : TEXT + " - " + DEFAULT_TEXT TEXT.empty() ? DEFAULT_TEXT : TEXT + " - " + DEFAULT_TEXT
); );
if (get_text().empty()) hide(); else show();
} }
Loading…
Cancel
Save