Browse Source

update window subtitle on refresh

CPP-GTK4
yggverse 4 months ago
parent
commit
61613c12af
  1. 6
      src/app/browser.cpp
  2. 11
      src/app/browser/main.cpp
  3. 3
      src/app/browser/main.hpp
  4. 25
      src/app/browser/main/tab.cpp
  5. 6
      src/app/browser/main/tab.hpp

6
src/app/browser.cpp

@ -102,7 +102,11 @@ Browser::Browser( @@ -102,7 +102,11 @@ Browser::Browser(
browserMain->refresh();
browserHeader->set_title(
browserMain->get_current_tab_label_text()
browserMain->get_current_tab_page_title()
);
browserHeader->set_subtitle(
browserMain->get_current_tab_page_subtitle()
);
}
);

11
src/app/browser/main.cpp

@ -28,9 +28,16 @@ Main::~Main() @@ -28,9 +28,16 @@ Main::~Main()
}
// Getters
Glib::ustring Main::get_current_tab_label_text()
Glib::ustring Main::get_current_tab_page_title()
{
return mainTab->get_label_text(
return mainTab->get_page_title(
mainTab->get_current_page()
);
};
Glib::ustring Main::get_current_tab_page_subtitle()
{
return mainTab->get_page_subtitle(
mainTab->get_current_page()
);
};

3
src/app/browser/main.hpp

@ -26,7 +26,8 @@ namespace app::browser @@ -26,7 +26,8 @@ namespace app::browser
~Main();
// Getters
Glib::ustring get_current_tab_label_text();
Glib::ustring get_current_tab_page_title();
Glib::ustring get_current_tab_page_subtitle();
// Actions
void tab_append();

25
src/app/browser/main/tab.cpp

@ -26,7 +26,7 @@ Tab::Tab() @@ -26,7 +26,7 @@ Tab::Tab()
Tab::~Tab() = default;
// Getters
Glib::ustring Tab::get_label_text(
Glib::ustring Tab::get_page_title(
const int & PAGE_NUMBER
) {
auto pageWidget = get_nth_page(
@ -35,9 +35,26 @@ Glib::ustring Tab::get_label_text( @@ -35,9 +35,26 @@ Glib::ustring Tab::get_label_text(
if (pageWidget != nullptr)
{
return get_tab_label_text(
* pageWidget
);
auto tabPage = (tab::Page *) pageWidget;
return tabPage->get_title();
}
return ""; // @TODO
};
Glib::ustring Tab::get_page_subtitle(
const int & PAGE_NUMBER
) {
auto pageWidget = get_nth_page(
PAGE_NUMBER
);
if (pageWidget != nullptr)
{
auto tabPage = (tab::Page *) pageWidget;
return tabPage->get_subtitle();
}
return ""; // @TODO

6
src/app/browser/main/tab.hpp

@ -18,7 +18,11 @@ namespace app::browser::main @@ -18,7 +18,11 @@ namespace app::browser::main
~Tab();
Glib::ustring get_label_text(
Glib::ustring get_page_title(
const int & PAGE_NUMBER
);
Glib::ustring get_page_subtitle(
const int & PAGE_NUMBER
);

Loading…
Cancel
Save