Browse Source

implement tab refresh method

CPP-GTK4
yggverse 3 months ago
parent
commit
bb343d5f59
  1. 36
      src/app/browser/main/tab.cpp
  2. 4
      src/app/browser/main/tab.hpp

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

@ -15,6 +15,10 @@ Tab::Tab() @@ -15,6 +15,10 @@ Tab::Tab()
signal_switch_page().connect(
[this](Gtk::Widget * pageWidget, guint page_number)
{
refresh(
page_number
);
// Refresh window elements, e.g. tab label to header bar
activate_action(
"win.refresh"
@ -112,3 +116,35 @@ void Tab::update( @@ -112,3 +116,35 @@ void Tab::update(
}
} // @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)
}

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

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

Loading…
Cancel
Save