disconnect previous connection on active

This commit is contained in:
yggverse 2024-09-15 04:10:12 +03:00
parent 9e56d37bae
commit d3c9cb843f
2 changed files with 12 additions and 1 deletions

View File

@ -17,6 +17,9 @@ Request::Request(
action__update = ACTION__UPDATE;
action__reload = ACTION__RELOAD;
// Init extras
progress_fraction = 0;
// Init widget
set_placeholder_text(
_("URL or search term...")
@ -53,8 +56,14 @@ void Request::update(
// Update progress
progress_fraction = PROGRESS_FRACTION;
// Reset previous connection
if (progress_connection.connected())
{
progress_connection.disconnect();
}
// Animate progress function
Glib::signal_timeout().connect(
progress_connection = Glib::signal_timeout().connect(
[this]() -> bool
{
double current_progress_fraction = get_progress_fraction();

View File

@ -8,6 +8,7 @@
#include <glibmm/regex.h>
#include <glibmm/ustring.h>
#include <gtkmm/entry.h>
#include <sigc++/connection.h>
#include <sqlite3.h>
namespace app::browser::main::tab::page::navigation
@ -65,6 +66,7 @@ namespace app::browser::main::tab::page::navigation
// Extras
double progress_fraction;
sigc::connection progress_connection;
// Defaults
const bool HEXPAND = true;