Browse Source

update variables namespace

CPP-GTK4
yggverse 3 months ago
parent
commit
3b1d918921
  1. 37
      src/app/browser/main/tab.cpp

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

@ -13,7 +13,7 @@ Tab::Tab()
// Init events // Init events
signal_switch_page().connect( signal_switch_page().connect(
[this](Gtk::Widget * page, guint page_number) [this](Gtk::Widget * pageWidget, guint 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(
@ -29,16 +29,14 @@ Tab::~Tab() = default;
Glib::ustring Tab::get_label_text( Glib::ustring Tab::get_label_text(
int page_number int page_number
) { ) {
auto page = get_nth_page( auto pageWidget = get_nth_page(
page_number page_number
); );
if (page != nullptr) if (pageWidget != nullptr)
{ {
return get_tab_label_text( return get_tab_label_text(
* get_nth_page( * pageWidget
page_number
)
); );
} }
@ -50,19 +48,17 @@ void Tab::append(
const Glib::ustring & page_navbar_request_text, const Glib::ustring & page_navbar_request_text,
bool focus bool focus
) { ) {
auto label = new tab::Label; auto tabPage = new tab::Page(
auto page = new tab::Page(
page_navbar_request_text page_navbar_request_text
); );
int page_number = append_page( int page_number = append_page(
* page, * tabPage,
* label * new tab::Label
); );
set_tab_reorderable( set_tab_reorderable(
* page, * tabPage,
REORDERABLE REORDERABLE
); );
@ -77,22 +73,19 @@ void Tab::append(
void Tab::close( void Tab::close(
int page_number int page_number
) { ) {
auto page = get_nth_page( auto pageWidget = get_nth_page(
page_number page_number
); );
auto label = get_tab_label( auto labelWidget = get_tab_label(
* page * pageWidget
); );
// @TODO data type
// delete page;
// delete label;
remove_page( remove_page(
page_number page_number
); );
// @TODO memory cleanup
// @TODO fix GtkGizmo reported min height, but sizes must be >= 0 // @TODO fix GtkGizmo reported min height, but sizes must be >= 0
} }
@ -115,13 +108,13 @@ void Tab::close_all()
void Tab::update( void Tab::update(
int page_number int page_number
) { ) {
auto page = get_nth_page( auto pageWidget = get_nth_page(
page_number page_number
); );
if (page != nullptr) if (pageWidget != nullptr)
{ {
page->activate_action( pageWidget->activate_action(
"page.update" "page.update"
); );
} }

Loading…
Cancel
Save