mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-29 20:44:25 +00:00
implement tab refresh method
This commit is contained in:
parent
9cb2c3fd98
commit
bb343d5f59
@ -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"
|
||||
@ -111,4 +115,36 @@ 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)
|
||||
}
|
@ -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…
x
Reference in New Issue
Block a user