implement tab refresh method

This commit is contained in:
yggverse 2024-08-27 13:50:29 +03:00
parent 9cb2c3fd98
commit bb343d5f59
2 changed files with 41 additions and 1 deletions

View File

@ -15,6 +15,10 @@ Tab::Tab()
signal_switch_page().connect( signal_switch_page().connect(
[this](Gtk::Widget * pageWidget, guint page_number) [this](Gtk::Widget * pageWidget, guint page_number)
{ {
refresh(
page_number
);
// Refresh window elements, e.g. tab label to header bar // Refresh window elements, e.g. tab label to header bar
activate_action( activate_action(
"win.refresh" "win.refresh"
@ -112,3 +116,35 @@ void Tab::update(
} }
} // @TODO } // @TODO
void Tab::refresh(
int page_number
) {
auto pageWidget = get_nth_page(
page_number
);
if (pageWidget == nullptr)
{
throw _("Tab page not found!");
}
auto labelWidget = get_tab_label(
* pageWidget
);
if (labelWidget == nullptr)
{
throw _("Tab label not found!");
}
auto tabPage = (tab::Page *) pageWidget;
auto tabLabel = (tab::Label *) labelWidget;
tabLabel->set_label(
tabPage->get_title()
);
// @TODO delegate refresh action to child level widgets (on available)
}

View File

@ -35,6 +35,10 @@ namespace app::browser::main
void close_right(); void close_right();
void close_all(); void close_all();
void refresh(
int page_number
);
void update( void update(
int page_number int page_number
); );