Browse Source

disconnect previous connection on active

CPP-GTK4
yggverse 2 months ago
parent
commit
d3c9cb843f
  1. 11
      src/app/browser/main/tab/page/navigation/request.cpp
  2. 2
      src/app/browser/main/tab/page/navigation/request.hpp

11
src/app/browser/main/tab/page/navigation/request.cpp

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

2
src/app/browser/main/tab/page/navigation/request.hpp

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

Loading…
Cancel
Save