Browse Source

update method name

CPP-GTK4
yggverse 2 months ago
parent
commit
2e5ebda5db
  1. 51
      src/app/browser/main/tab/page.cpp
  2. 14
      src/app/browser/main/tab/page.hpp
  3. 2
      src/app/browser/main/tab/page/progressbar.cpp
  4. 2
      src/app/browser/main/tab/page/progressbar.hpp

51
src/app/browser/main/tab/page.cpp

@ -54,7 +54,7 @@ Page::Page( @@ -54,7 +54,7 @@ Page::Page(
);
// Init extras
set(
refresh(
TITLE,
SUBTITLE,
0
@ -83,6 +83,24 @@ void Page::forward() @@ -83,6 +83,24 @@ void Page::forward()
pageNavbar->forward();
}
void Page::refresh(
const Glib::ustring & TITLE,
const Glib::ustring & SUBTITLE,
const double & PROGRESS
) {
title = TITLE;
subtitle = SUBTITLE;
pageProgressbar->refresh(
PROGRESS
);
activate_action(
"win.refresh"
);
}
void Page::update()
{
// Update navigation history
@ -91,7 +109,7 @@ void Page::update() @@ -91,7 +109,7 @@ void Page::update()
);
// Update page extras
set(
refresh(
pageNavbar->get_request_host(),
Glib::ustring::sprintf(
_("load %s.."),
@ -126,7 +144,7 @@ void Page::update() @@ -126,7 +144,7 @@ void Page::update()
pageNavbar->get_request_text(), 1965,
[this](const Glib::RefPtr<Gio::AsyncResult> & result)
{
set(
refresh(
pageNavbar->get_request_host(),
Glib::ustring::sprintf(
_("connect %s.."),
@ -143,7 +161,7 @@ void Page::update() @@ -143,7 +161,7 @@ void Page::update()
catch (const Glib::Error & EXCEPTION)
{
set(
refresh(
pageNavbar->get_request_host(),
EXCEPTION.what(), 1
);
@ -159,7 +177,7 @@ void Page::update() @@ -159,7 +177,7 @@ void Page::update()
request.size(),
[this](const Glib::RefPtr<Gio::AsyncResult> & result)
{
set(
refresh(
pageNavbar->get_request_host(),
Glib::ustring::sprintf(
_("request %s.."),
@ -174,7 +192,7 @@ void Page::update() @@ -174,7 +192,7 @@ void Page::update()
sizeof(buffer) - 1,
[this](const Glib::RefPtr<Gio::AsyncResult> & result)
{
set(
refresh(
pageNavbar->get_request_host(),
Glib::ustring::sprintf(
_("reading %s.."),
@ -217,7 +235,7 @@ void Page::update() @@ -217,7 +235,7 @@ void Page::update()
GioSocketConnection_RefPtr->close();
set(
refresh(
pageNavbar->get_request_host(), // @TODO title
pageNavbar->get_request_path().empty() ? pageNavbar->get_request_host()
: pageNavbar->get_request_path()
@ -247,22 +265,3 @@ void Page::update() @@ -247,22 +265,3 @@ void Page::update()
// @TODO search request
}
}
// Private helpers
void Page::set(
const Glib::ustring & TITLE,
const Glib::ustring & SUBTITLE,
const double & PROGRESS
) {
title = TITLE;
subtitle = SUBTITLE;
pageProgressbar->set(
PROGRESS
);
activate_action(
"win.refresh"
);
}

14
src/app/browser/main/tab/page.hpp

@ -41,13 +41,6 @@ namespace app::browser::main::tab @@ -41,13 +41,6 @@ namespace app::browser::main::tab
page::Navbar * pageNavbar;
page::Progressbar * pageProgressbar;
// Helpers
void set(
const Glib::ustring & TITLE,
const Glib::ustring & SUBTITLE,
const double & PROGRESS
);
public:
Page(
@ -63,6 +56,13 @@ namespace app::browser::main::tab @@ -63,6 +56,13 @@ namespace app::browser::main::tab
// Actions
void back();
void forward();
void refresh(
const Glib::ustring & TITLE,
const Glib::ustring & SUBTITLE,
const double & PROGRESS
);
void update();
};
}

2
src/app/browser/main/tab/page/progressbar.cpp

@ -20,7 +20,7 @@ Progressbar::Progressbar() @@ -20,7 +20,7 @@ Progressbar::Progressbar()
}
// Public actions
void Progressbar::set(
void Progressbar::refresh(
double fraction
) {
// Toggle transparency

2
src/app/browser/main/tab/page/progressbar.hpp

@ -18,7 +18,7 @@ namespace app::browser::main::tab::page @@ -18,7 +18,7 @@ namespace app::browser::main::tab::page
Progressbar();
void set(
void refresh(
double fraction
);
};

Loading…
Cancel
Save