Browse Source

implement base button refresh

CPP-GTK4
yggverse 3 months ago
parent
commit
f08863ece8
  1. 21
      src/app/browser/main/tab/data/navbar.cpp

21
src/app/browser/main/tab/data/navbar.cpp

@ -5,6 +5,8 @@ @@ -5,6 +5,8 @@
#include "navbar/request.hpp"
#include "navbar/update.hpp"
#include "../../../../../lib/url.hpp"
using namespace app::browser::main::tab::data;
Navbar::Navbar()
@ -88,9 +90,24 @@ Navbar::~Navbar() = default; @@ -88,9 +90,24 @@ Navbar::~Navbar() = default;
// Actions
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(
(bool) request->get_text_length()
has_request
);
}

Loading…
Cancel
Save