mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-30 13:04:13 +00:00
implement base button refresh
This commit is contained in:
parent
d6be03febf
commit
f08863ece8
@ -5,6 +5,8 @@
|
|||||||
#include "navbar/request.hpp"
|
#include "navbar/request.hpp"
|
||||||
#include "navbar/update.hpp"
|
#include "navbar/update.hpp"
|
||||||
|
|
||||||
|
#include "../../../../../lib/url.hpp"
|
||||||
|
|
||||||
using namespace app::browser::main::tab::data;
|
using namespace app::browser::main::tab::data;
|
||||||
|
|
||||||
Navbar::Navbar()
|
Navbar::Navbar()
|
||||||
@ -88,9 +90,24 @@ Navbar::~Navbar() = default;
|
|||||||
// Actions
|
// Actions
|
||||||
void Navbar::refresh()
|
void Navbar::refresh()
|
||||||
{
|
{
|
||||||
// Deactivate on request value is empty
|
// Detect request has value
|
||||||
|
bool has_request = request->get_text_length();
|
||||||
|
|
||||||
|
// Toggle base button sensibility
|
||||||
|
auto url = new ::lib::Url(
|
||||||
|
request->get_text()
|
||||||
|
);
|
||||||
|
|
||||||
|
base->set_sensitive(
|
||||||
|
has_request && !url->host.empty()
|
||||||
|
&& !url->path.empty()
|
||||||
|
);
|
||||||
|
|
||||||
|
delete url;
|
||||||
|
|
||||||
|
// Toggle update button sensibility
|
||||||
update->set_sensitive(
|
update->set_sensitive(
|
||||||
(bool) request->get_text_length()
|
has_request
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user