From d88bea1fa6826dfab6aade66f5ee9b22f7b3a8c9 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 20 Aug 2024 16:23:13 +0300 Subject: [PATCH] implement custom title setter --- src/app/browser/header/main.cpp | 6 +++--- src/app/browser/header/main/title.cpp | 14 ++++++++++++-- src/app/browser/header/main/title.hpp | 6 ++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/app/browser/header/main.cpp b/src/app/browser/header/main.cpp index a35d110b..e65d914d 100644 --- a/src/app/browser/header/main.cpp +++ b/src/app/browser/header/main.cpp @@ -28,9 +28,9 @@ Main::~Main() } void Main::set_title( - const Glib::ustring text + const Glib::ustring value ) { - title->set_text( - text + title->set( + value ); } \ No newline at end of file diff --git a/src/app/browser/header/main/title.cpp b/src/app/browser/header/main/title.cpp index 46e59cf6..6983dae2 100644 --- a/src/app/browser/header/main/title.cpp +++ b/src/app/browser/header/main/title.cpp @@ -24,7 +24,17 @@ Title::Title() WIDTH_CHARS ); - // @TODO + set_text( + DEFAULT_TEXT + ); } -Title::~Title() = default; \ No newline at end of file +Title::~Title() = default; + +void Title::set( + const Glib::ustring value +) { + set_text( + value.empty() ? DEFAULT_TEXT : value + " - " + DEFAULT_TEXT + ); +} \ No newline at end of file diff --git a/src/app/browser/header/main/title.hpp b/src/app/browser/header/main/title.hpp index 2ad64d6d..26063003 100644 --- a/src/app/browser/header/main/title.hpp +++ b/src/app/browser/header/main/title.hpp @@ -12,11 +12,17 @@ namespace app::browser::header::main { const int WIDTH_CHARS = 5; + const Glib::ustring DEFAULT_TEXT = "Yoda"; + public: Title(); ~Title(); + + void set( + const Glib::ustring value + ); }; }