Commit dbd6d484 authored by IBBoard's avatar IBBoard Committed by Daniel Garcia Moreno

Stop chapter number updates breaking navigation to anchor links

The reload_current_chapter() function can't check the current URI
to see whether it has changed and *must* reload the chapter so that
pagination changes are applied. Instead, we can temporarily remove
the signal handler to prevent `notify::chapter` triggering a page
reload that breaks anchor links.
parent a5f2952e
......@@ -249,6 +249,9 @@ set_current_chapter_by_uri (WebKitWebView *web_view)
// so we don't need to do anything here
}
static void
reload_current_chapter (GepubWidget *widget);
static void
docready_cb (WebKitWebView *web_view,
WebKitLoadEvent load_event,
......@@ -258,7 +261,11 @@ docready_cb (WebKitWebView *web_view,
if (load_event == WEBKIT_LOAD_FINISHED) {
reload_length_cb (GTK_WIDGET (widget), NULL, NULL);
g_signal_handlers_disconnect_by_func (widget->doc,
reload_current_chapter, widget);
set_current_chapter_by_uri (web_view);
g_signal_connect_swapped (widget->doc, "notify::chapter",
G_CALLBACK (reload_current_chapter), widget);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment