[balsa] libbalsa-html: Do not use archaic 200px height
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] libbalsa-html: Do not use archaic 200px height
- Date: Sun, 13 Oct 2019 15:54:21 +0000 (UTC)
commit a389922cbffd887cc17396a0818221c0eb07257a
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sun Oct 13 11:51:32 2019 -0400
libbalsa-html: Do not use archaic 200px height
Do not use archaic 200px default height; now that we set
GtkWidget:vexpand to TRUE, the natural height works better.
* libbalsa/html.c: for cosmetics, define LBH_NATURAL_SIZE as -1;
(lbh_web_view_new), (libbalsa_html_print_bitmap): use it for the height;
(libbalsa_html_new): use it for the width.
ChangeLog | 10 ++++++++++
libbalsa/html.c | 12 +++++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cf2d55fc2..5937d6151 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2019-10-13 Peter Bloomfield <pbloomfield bellsouth net>
+
+ Do not use archaic 200px default height; now that we set
+ GtkWidget:vexpand to TRUE, the natural height works better.
+
+ * libbalsa/html.c: for cosmetics, define LBH_NATURAL_SIZE as -1;
+ (lbh_web_view_new): use it for the height;
+ (libbalsa_html_print_bitmap): ditto;
+ (libbalsa_html_new): use it for the width.
+
2019-10-12 Peter Bloomfield <pbloomfield bellsouth net>
* libbalsa/html.c (lbh_web_view_new): set v-expand on the
diff --git a/libbalsa/html.c b/libbalsa/html.c
index 5ab99d600..656d8fa7e 100644
--- a/libbalsa/html.c
+++ b/libbalsa/html.c
@@ -52,6 +52,9 @@
/* zoom level for printing */
#define HTML_PRINT_ZOOM 2.0
+/* LBH_NATURAL_SIZE means, well, to use a widget's natural width or height */
+#define LBH_NATURAL_SIZE (-1)
+
/*
* lbh_get_body_content
@@ -592,7 +595,6 @@ lbh_context_menu_cb(WebKitWebView * web_view,
static WebKitWebView *
lbh_web_view_new(LibBalsaWebKitInfo *info,
gint width,
- gint height,
gboolean auto_load_images)
{
WebKitWebView *view;
@@ -603,7 +605,7 @@ lbh_web_view_new(LibBalsaWebKitInfo *info,
info_for_cid = info;
view = WEBKIT_WEB_VIEW(webkit_web_view_new());
g_object_set_data_full(G_OBJECT(view), LIBBALSA_HTML_INFO, info, (GDestroyNotify) lbh_webkit_info_free);
- gtk_widget_set_size_request(GTK_WIDGET(view), width, height);
+ gtk_widget_set_size_request(GTK_WIDGET(view), width, LBH_NATURAL_SIZE);
gtk_widget_set_vexpand(GTK_WIDGET(view), TRUE);
settings = webkit_web_view_get_settings(view);
@@ -694,8 +696,8 @@ libbalsa_html_print_bitmap(LibBalsaMessageBody *body,
offline_window = gtk_offscreen_window_new();
render_width = (gint) (width * HTML_PRINT_DPI / 72.0);
g_debug("%s: request Cairo width %g, render width %d", __func__, width, render_width);
- gtk_window_set_default_size(GTK_WINDOW(offline_window), render_width, 200);
- view = lbh_web_view_new(info, render_width, 200, load_external_images || (have_src_cid &&
!have_src_oth));
+ gtk_window_set_default_size(GTK_WINDOW(offline_window), render_width, LBH_NATURAL_SIZE);
+ view = lbh_web_view_new(info, render_width, load_external_images || (have_src_cid && !have_src_oth));
webkit_web_view_set_zoom_level(view, HTML_PRINT_ZOOM); /* heuristic setting, any way
to calculate it? */
gtk_container_add(GTK_CONTAINER(offline_window), GTK_WIDGET(view));
gtk_widget_show_all(offline_window);
@@ -764,7 +766,7 @@ libbalsa_html_new(LibBalsaMessageBody * body,
have_src_cid = g_regex_match_simple(CID_REGEX, text, G_REGEX_CASELESS, 0);
have_src_oth = g_regex_match_simple(SRC_REGEX, text, G_REGEX_CASELESS, 0);
- info->web_view = lbh_web_view_new(info, -1, 200, have_src_cid && !have_src_oth);
+ info->web_view = lbh_web_view_new(info, LBH_NATURAL_SIZE, have_src_cid && !have_src_oth);
g_signal_connect(info->web_view, "mouse-target-changed",
G_CALLBACK(lbh_mouse_target_changed_cb), info);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]