[balsa] libbalsa-html: Look deeper for the WebKitWebView
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] libbalsa-html: Look deeper for the WebKitWebView
- Date: Fri, 11 Oct 2019 18:56:04 +0000 (UTC)
commit c654f7f758730f710c640925831a2c7697290bf3
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Fri Oct 11 14:31:15 2019 -0400
libbalsa-html: Look deeper for the WebKitWebView
* libbalsa/html.c (libbalsa_html_new), (lbh_get_web_view_helper),
(lbh_get_web_view): if the widget is not a WebKitWebView but is
a GtkContainer, look at all its descendants for a WebKitWebView.
ChangeLog | 8 ++++++++
libbalsa/html.c | 28 +++++++++++++++++++++++-----
2 files changed, 31 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index af33463d3..97020cf2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-10-11 Peter Bloomfield <pbloomfield bellsouth net>
+
+ libbalsa-html: Look deeper to find the WebKitWebView
+
+ * libbalsa/html.c (libbalsa_html_new), (lbh_get_web_view_helper),
+ (lbh_get_web_view): if the widget is not a WebKitWebView but is
+ a GtkContainer, look at all its descendants for a WebKitWebView.
+
2019-10-01 Peter Bloomfield <pbloomfield bellsouth net>
Build: we need -Wformat for -Wformat-security to be effective
diff --git a/libbalsa/html.c b/libbalsa/html.c
index 6692b771f..1fc99e6db 100644
--- a/libbalsa/html.c
+++ b/libbalsa/html.c
@@ -771,7 +771,6 @@ libbalsa_html_new(LibBalsaMessageBody * body,
G_CALLBACK(lbh_context_menu_cb), info);
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- g_object_set_data(G_OBJECT(vbox), "libbalsa-html-web-view", info->web_view);
gtk_box_pack_end(GTK_BOX(vbox), GTK_WIDGET(info->web_view), TRUE, TRUE, 0);
/* Simple check for possible resource requests: */
@@ -795,14 +794,33 @@ libbalsa_html_to_string(gchar ** text, size_t len)
}
/*
- * We may be passed either the WebKitWebView or its container:
+ * We may be passed either the WebKitWebView or a container:
*/
+
+static void
+lbh_get_web_view_helper(GtkWidget *widget, gpointer data)
+{
+ GtkWidget **child = data;
+
+ if (*child == NULL) {
+ if (WEBKIT_IS_WEB_VIEW(widget))
+ *child = widget;
+ else if (GTK_IS_CONTAINER(widget))
+ gtk_container_foreach((GtkContainer *) widget,
+ lbh_get_web_view_helper, data);
+ }
+}
+
static gboolean
lbh_get_web_view(GtkWidget * widget, WebKitWebView ** web_view)
{
- if (!WEBKIT_IS_WEB_VIEW(widget))
- widget =
- g_object_get_data(G_OBJECT(widget), "libbalsa-html-web-view");
+ if (!WEBKIT_IS_WEB_VIEW(widget)) {
+ GtkWidget *child = NULL;
+
+ lbh_get_web_view_helper(widget, &child);
+ if (child != NULL)
+ widget = child;
+ }
*web_view = (WebKitWebView *) widget;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]