Browse Source

update variables namespace format

CPP-GTK4
yggverse 3 months ago
parent
commit
5cfd7247ae
  1. 58
      src/app/browser/main/tab/page/navbar.cpp
  2. 14
      src/app/browser/main/tab/page/navbar.hpp

58
src/app/browser/main/tab/page/navbar.cpp

@ -36,43 +36,43 @@ Navbar::Navbar(
); );
// Init components // Init components
base = new navbar::Base(); navbarBase = new navbar::Base();
append( append(
* base * navbarBase
); );
history = new navbar::History(); navbarHistory = new navbar::History();
append( append(
* history * navbarHistory
); );
update = new navbar::Update(); navbarUpdate = new navbar::Update();
append( append(
* update * navbarUpdate
); );
request = new navbar::Request( navbarRequest = new navbar::Request(
request_text request_text
); );
append( append(
* request * navbarRequest
); );
bookmark = new navbar::Bookmark(); navbarBookmark = new navbar::Bookmark();
append( append(
* bookmark * navbarBookmark
); );
// Init actions group // Init actions group
action_group = Gio::SimpleActionGroup::create(); auto GioSimpleActionGroup_RefPtr = Gio::SimpleActionGroup::create();
// Define group actions // Define group actions
action_group->add_action( GioSimpleActionGroup_RefPtr->add_action(
"refresh", "refresh",
[this] [this]
{ {
@ -82,30 +82,30 @@ Navbar::Navbar(
insert_action_group( insert_action_group(
"navbar", "navbar",
action_group GioSimpleActionGroup_RefPtr
); );
} }
Navbar::~Navbar() Navbar::~Navbar()
{ {
delete base; delete navbarBase;
delete bookmark; delete navbarBookmark;
delete history; delete navbarHistory;
delete request; delete navbarRequest;
delete update; delete navbarUpdate;
}; };
// Actions // Actions
void Navbar::refresh() void Navbar::refresh()
{ {
// Toggle base button sensibility // Toggle base button sensibility
base->set_sensitive( navbarBase->set_sensitive(
!request->get_host().empty() && !request->get_path().empty() !navbarRequest->get_host().empty() && !navbarRequest->get_path().empty()
); );
// Toggle update button sensibility // Toggle update button sensibility
update->set_sensitive( navbarUpdate->set_sensitive(
(bool) request->get_text_length() navbarRequest->get_text_length() > 0
); );
} }
@ -113,7 +113,7 @@ void Navbar::refresh()
void Navbar::set_request_text( void Navbar::set_request_text(
const Glib::ustring & value const Glib::ustring & value
) { ) {
request->set_text( navbarRequest->set_text(
value value
); );
@ -123,30 +123,30 @@ void Navbar::set_request_text(
// Getters // Getters
Glib::ustring Navbar::get_request_text() Glib::ustring Navbar::get_request_text()
{ {
return request->get_text(); return navbarRequest->get_text();
} }
Glib::ustring Navbar::get_request_scheme() Glib::ustring Navbar::get_request_scheme()
{ {
return request->get_scheme(); return navbarRequest->get_scheme();
} }
Glib::ustring Navbar::get_request_host() Glib::ustring Navbar::get_request_host()
{ {
return request->get_host(); return navbarRequest->get_host();
} }
Glib::ustring Navbar::get_request_path() Glib::ustring Navbar::get_request_path()
{ {
return request->get_path(); return navbarRequest->get_path();
} }
Glib::ustring Navbar::get_request_query() Glib::ustring Navbar::get_request_query()
{ {
return request->get_query(); return navbarRequest->get_query();
} }
Glib::ustring Navbar::get_request_port() Glib::ustring Navbar::get_request_port()
{ {
return request->get_port(); return navbarRequest->get_port();
} }

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

@ -2,7 +2,6 @@
#define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HPP #define APP_BROWSER_MAIN_TAB_PAGE_NAVBAR_HPP
#include <giomm/simpleactiongroup.h> #include <giomm/simpleactiongroup.h>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include <gtkmm/box.h> #include <gtkmm/box.h>
@ -19,15 +18,12 @@ namespace app::browser::main::tab::page
class Navbar : public Gtk::Box class Navbar : public Gtk::Box
{ {
// Actions
Glib::RefPtr<Gio::SimpleActionGroup> action_group;
// Components // Components
navbar::Base * base; navbar::Base * navbarBase;
navbar::Bookmark * bookmark; navbar::Bookmark * navbarBookmark;
navbar::History * history; navbar::History * navbarHistory;
navbar::Request * request; navbar::Request * navbarRequest;
navbar::Update * update; navbar::Update * navbarUpdate;
// Defaults // Defaults
const int SPACING = 8; const int SPACING = 8;

Loading…
Cancel
Save