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( @@ -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( @@ -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();

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

@ -8,6 +8,7 @@ @@ -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 @@ -65,6 +66,7 @@ namespace app::browser::main::tab::page::navigation
// Extras
double progress_fraction;
sigc::connection progress_connection;
// Defaults
const bool HEXPAND = true;

Loading…
Cancel
Save