diff --git a/src/app/browser/main/tab/data.cpp b/src/app/browser/main/tab/data.cpp index eb4184b0..0af742e3 100644 --- a/src/app/browser/main/tab/data.cpp +++ b/src/app/browser/main/tab/data.cpp @@ -10,7 +10,7 @@ Data::Data() Gtk::Orientation::VERTICAL ); - // Init children components + // Init components navbar = new data::Navbar(); append( @@ -20,22 +20,25 @@ Data::Data() // Init actions group action_group = Gio::SimpleActionGroup::create(); - // Define actions - action_group->add_action( - "update", - sigc::mem_fun( - * this, - & Data::update - ) - ); + // Define group actions + action_group->add_action( + "update", + sigc::mem_fun( + * this, + & Data::update + ) + ); insert_action_group( - "tab", + "data", action_group ); } Data::~Data() = default; +// Actions void Data::update() -{} // @TODO +{ + // navbar->get_request_value() @TODO +} diff --git a/src/app/browser/main/tab/data/navbar.cpp b/src/app/browser/main/tab/data/navbar.cpp index fcf4d4ea..38804589 100644 --- a/src/app/browser/main/tab/data/navbar.cpp +++ b/src/app/browser/main/tab/data/navbar.cpp @@ -34,7 +34,7 @@ Navbar::Navbar() MARGIN ); - // Init elements + // Init components base = new navbar::Base(); append( @@ -64,6 +64,38 @@ Navbar::Navbar() append( * bookmark ); + + // Init actions group + action_group = Gio::SimpleActionGroup::create(); + + // Define group actions + action_group->add_action( + "refresh", + sigc::mem_fun( + * this, + & Navbar::refresh + ) + ); + + insert_action_group( + "navbar", + action_group + ); } Navbar::~Navbar() = default; + +// Actions +void Navbar::refresh() +{ + // Deactivate on request value is empty + update->set_sensitive( + (bool) request->get_text_length() + ); +} + +// Getters +Glib::ustring Navbar::get_request_value() +{ + return request->get_text(); +} \ No newline at end of file diff --git a/src/app/browser/main/tab/data/navbar.hpp b/src/app/browser/main/tab/data/navbar.hpp index e3d1f212..5401b0ba 100644 --- a/src/app/browser/main/tab/data/navbar.hpp +++ b/src/app/browser/main/tab/data/navbar.hpp @@ -1,7 +1,11 @@ #ifndef APP_BROWSER_MAIN_TAB_DATA_NAVBAR_HPP #define APP_BROWSER_MAIN_TAB_DATA_NAVBAR_HPP +#include +#include +#include #include +#include namespace app::browser::main::tab::data { @@ -18,9 +22,8 @@ namespace app::browser::main::tab::data { private: - // Defaults - const int SPACING = 8; - const int MARGIN = 8; + // Actions + Glib::RefPtr action_group; // Components navbar::Base * base; @@ -29,11 +32,20 @@ namespace app::browser::main::tab::data navbar::Request * request; navbar::Update * update; + // Defaults + const int SPACING = 8; + const int MARGIN = 8; + public: Navbar(); - ~Navbar(); + + // Actions + void refresh(); + + // Getters + Glib::ustring get_request_value(); }; } diff --git a/src/app/browser/main/tab/data/navbar/request.cpp b/src/app/browser/main/tab/data/navbar/request.cpp index 9e306ce3..ef53a065 100644 --- a/src/app/browser/main/tab/data/navbar/request.cpp +++ b/src/app/browser/main/tab/data/navbar/request.cpp @@ -33,4 +33,8 @@ void Request::on_activate() {} // @TODO void Request::on_change() -{} // @TODO +{ + activate_action( + "navbar.refresh" + ); +}