Browse Source

fix sensitivity detection

CPP-GTK4
yggverse 3 months ago
parent
commit
b54a3aeecc
  1. 33
      src/app/browser/main/tab/page/navigation/base.cpp

33
src/app/browser/main/tab/page/navigation/base.cpp

@ -30,8 +30,12 @@ Base::Base(
Glib::Variant<Glib::ustring>::create( Glib::Variant<Glib::ustring>::create(
Glib::ustring::sprintf( Glib::ustring::sprintf(
"%s://%s/", "%s://%s/",
g_uri_get_scheme(uri), // @TODO NULL validate? g_uri_get_scheme(
g_uri_get_host(uri) uri
), // @TODO NULL validate?
g_uri_get_host(
uri
)
) // at this moment, there is no G_URI_HIDE_*HOST option for g_uri_to_string_partial, ) // at this moment, there is no G_URI_HIDE_*HOST option for g_uri_to_string_partial,
// build address manually using sprintf @TODO // build address manually using sprintf @TODO
) )
@ -49,9 +53,28 @@ void Base::update(
NULL // @TODO GError * NULL // @TODO GError *
); );
bool sensitive = false;
if (uri != NULL)
{
const char * HOST = g_uri_get_host(
uri
);
if (HOST != NULL)
{
const char * PATH = g_uri_get_path(
uri
);
if (PATH != NULL && 0 != strcmp(PATH, "/"))
{
sensitive = true;
}
}
}
set_sensitive( set_sensitive(
NULL != uri && sensitive
NULL != g_uri_get_host(uri) &&
NULL != g_uri_get_path(uri)
); );
} }
Loading…
Cancel
Save