[libgepub/wip/hadess/cant-register-more-than-once: 3/3] widget: Fix ePubs not rendering after the first one
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgepub/wip/hadess/cant-register-more-than-once: 3/3] widget: Fix ePubs not rendering after the first one
- Date: Wed, 31 Mar 2021 10:17:42 +0000 (UTC)
commit 2b1e373fec112a27e9c273eebf2bc077fa5559c6
Author: Bastien Nocera <hadess hadess net>
Date: Tue Mar 30 20:10:11 2021 +0200
widget: Fix ePubs not rendering after the first one
Fix critical error in gnome-books:
Cannot register URI scheme epub more than once
Create a new WebKitWebContext for each widget, so we don't run into the
error above.
libgepub/gepub-widget.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/libgepub/gepub-widget.c b/libgepub/gepub-widget.c
index 9615227..d2559b9 100644
--- a/libgepub/gepub-widget.c
+++ b/libgepub/gepub-widget.c
@@ -388,6 +388,25 @@ gepub_widget_init (GepubWidget *widget)
widget->line_height = 0;
}
+static GObject *
+gepub_widget_constructor (GType gtype,
+ guint n_properties,
+ GObjectConstructParam *properties)
+{
+ GObject *object;
+ GObjectClass *parent_class;
+
+ parent_class = G_OBJECT_CLASS (gepub_widget_parent_class);
+ object = parent_class->constructor (gtype, n_properties, properties);
+
+ g_object_set (object,
+ "web-context", g_object_new (WEBKIT_TYPE_WEB_CONTEXT, NULL),
+ NULL);
+
+ return object;
+}
+
+
static void
gepub_widget_constructed (GObject *object)
{
@@ -407,6 +426,7 @@ gepub_widget_class_init (GepubWidgetClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->constructor = gepub_widget_constructor;
object_class->constructed = gepub_widget_constructed;
object_class->finalize = gepub_widget_finalize;
object_class->set_property = gepub_widget_set_property;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]