[libgepub] Stop chapter number updates breaking navigation to anchor links
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgepub] Stop chapter number updates breaking navigation to anchor links
- Date: Sat, 27 Apr 2019 13:00:46 +0000 (UTC)
commit dbd6d48429acfc41005de0a000298a42f5280530
Author: IBBoard <dev ibboard co uk>
Date: Sat Apr 27 13:45:01 2019 +0100
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.
libgepub/gepub-widget.c | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/libgepub/gepub-widget.c b/libgepub/gepub-widget.c
index 25da498..9615227 100644
--- a/libgepub/gepub-widget.c
+++ b/libgepub/gepub-widget.c
@@ -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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]