Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jun 2017 18:46:45 +0000 (UTC)
From:      Pawel Pekala <pawel@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r443720 - in head/mail/claws-mail-fancy: . files
Message-ID:  <201706161846.v5GIkjA7006699@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pawel
Date: Fri Jun 16 18:46:44 2017
New Revision: 443720
URL: https://svnweb.freebsd.org/changeset/ports/443720

Log:
  Add upstream patch fixing htmlview display regressions. Due to webkit
  internal changes htmlview can show blank page or contents of previous
  email html part.

Added:
  head/mail/claws-mail-fancy/files/
  head/mail/claws-mail-fancy/files/patch-prev-htmlview-fix   (contents, props changed)
Modified:
  head/mail/claws-mail-fancy/Makefile

Modified: head/mail/claws-mail-fancy/Makefile
==============================================================================
--- head/mail/claws-mail-fancy/Makefile	Fri Jun 16 18:46:08 2017	(r443719)
+++ head/mail/claws-mail-fancy/Makefile	Fri Jun 16 18:46:44 2017	(r443720)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	fancy
-PORTREVISION=	0
+PORTREVISION=	1
 
 COMMENT=	Webkit based HTML renderer plugin for Claws Mail
 

Added: head/mail/claws-mail-fancy/files/patch-prev-htmlview-fix
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/claws-mail-fancy/files/patch-prev-htmlview-fix	Fri Jun 16 18:46:44 2017	(r443720)
@@ -0,0 +1,236 @@
+diff --git src/plugins/fancy/fancy_viewer.c src/plugins/fancy/fancy_viewer.c
+index 3e818f884..079a18e63 100644
+--- src/plugins/fancy/fancy_viewer.c
++++ src/plugins/fancy/fancy_viewer.c
+@@ -42,12 +42,9 @@ static void
+ over_link_cb (WebKitWebView *view, const gchar *wtf, const gchar *link,
+ 	      FancyViewer *viewer, void *wtfa);
+ 
+-static void
+-load_progress_cb (WebKitWebView *view, gint progress, FancyViewer *viewer);
+ 
+-static WebKitNavigationResponse
+-navigation_requested_cb (WebKitWebView *view, WebKitWebFrame *frame,
+-			 WebKitNetworkRequest *netreq, FancyViewer *viewer);
++static void
++load_progress_cb(WebKitWebView *view, GParamSpec* pspec, FancyViewer *viewer);
+ 
+ static MimeViewerFactory fancy_viewer_factory;
+ 
+@@ -199,15 +196,6 @@ static void fancy_set_defaults(FancyViewer *viewer)
+ 	fancy_apply_prefs(viewer);
+ }
+ 
+-static void fancy_load_uri(FancyViewer *viewer, const gchar *uri)
+-{
+-#if WEBKIT_CHECK_VERSION(1,1,1)
+-	webkit_web_view_load_uri(viewer->view, uri);
+-#else
+-	webkit_web_view_open(viewer->view, uri);
+-#endif
+-}
+-
+ static gboolean fancy_show_mimepart_real(MimeViewer *_viewer)
+ {
+ 	FancyViewer *viewer = (FancyViewer *) _viewer;
+@@ -240,6 +228,7 @@ static gboolean fancy_show_mimepart_real(MimeViewer *_viewer)
+ 	}
+ 	else {
+ 		const gchar *charset = NULL;
++		gchar *contents = NULL;
+ 		if (messageview && messageview->forced_charset)
+ 			charset = _viewer->mimeview->messageview->forced_charset;
+ 		else
+@@ -248,14 +237,20 @@ static gboolean fancy_show_mimepart_real(MimeViewer *_viewer)
+ 			charset = conv_get_locale_charset_str();
+ 		debug_print("using %s charset\n", charset);
+ 		g_object_set(viewer->settings, "default-encoding", charset, NULL);
+-		gchar *tmp = g_filename_to_uri(viewer->filename, NULL, NULL);
++		
++		contents = file_read_to_str_no_recode(viewer->filename);
++		
+ 		debug_print("zoom_level: %i\n", fancy_prefs.zoom_level);
+ 		webkit_web_view_set_zoom_level(viewer->view, (fancy_prefs.zoom_level / 100.0));
+ 
+ 		fancy_set_defaults(viewer);
+-		fancy_load_uri(viewer, tmp);
+ 
+-		g_free(tmp);
++		webkit_web_view_load_string(viewer->view,
++					    contents,
++					    "text/html",
++					    charset,
++					    NULL);
++		g_free(contents);
+ 	}
+ 	viewer->loading = FALSE;
+ 	return FALSE;
+@@ -349,7 +344,7 @@ static void fancy_clear_viewer(MimeViewer *_viewer)
+ 	viewer->cur_link = NULL;
+ 	fancy_set_defaults(viewer);
+ 
+-	fancy_load_uri(viewer, "about:blank");
++	webkit_web_view_load_uri(viewer->view, "about:blank");
+ 
+ 	debug_print("fancy_clear_viewer\n");
+ 	fancy_prefs.zoom_level = webkit_web_view_get_zoom_level(viewer->view) * 100;
+@@ -368,25 +363,35 @@ static void fancy_destroy_viewer(MimeViewer *_viewer)
+ 	g_free(viewer);
+ }
+ 
+-static WebKitNavigationResponse
+-navigation_requested_cb(WebKitWebView *view, WebKitWebFrame *frame,
+-						WebKitNetworkRequest *netreq, FancyViewer *viewer)
++static gboolean
++navigation_policy_cb (WebKitWebView             *web_view,
++		      WebKitWebFrame            *frame,
++		      WebKitNetworkRequest      *request,
++		      WebKitWebNavigationAction *navigation_action,
++		      WebKitWebPolicyDecision   *policy_decision,
++		      FancyViewer		*viewer)
+ {
+-	const gchar *uri = webkit_network_request_get_uri(netreq);
++	const gchar *uri = webkit_network_request_get_uri(request);
+ 
+ 	debug_print("navigation requested to %s\n", uri);
+ 
+ 	if (!strncmp(uri, "mailto:", 7)) {
++		debug_print("Opening message window\n");
+ 		compose_new(NULL, uri + 7, NULL);
+-		return WEBKIT_NAVIGATION_RESPONSE_IGNORE;
+-	} else if (!strncmp(uri, "file://", 7)) {
+-		return WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
+-	} else if (viewer->override_prefs_remote_content)
+-		return WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
+-	else {
++		webkit_web_policy_decision_ignore(policy_decision);
++	} else if (!strncmp(uri, "file://", 7) || !strcmp(uri, "about:blank")) {
++		debug_print("local navigation request ACCEPTED\n");
++		webkit_web_policy_decision_use(policy_decision);
++	} else if (viewer->override_prefs_remote_content) {
++		debug_print("remote navigation request ACCEPTED\n");
++		webkit_web_policy_decision_use(policy_decision);
++	} else {
++		debug_print("remote navigation request IGNORED\n");
+ 		fancy_show_notice(viewer, _("Remote content loading is disabled."));
+-		return WEBKIT_NAVIGATION_RESPONSE_IGNORE;
++		webkit_web_policy_decision_ignore(policy_decision);
+ 	}
++
++	return true;
+ }
+ 
+ static void resource_request_starting_cb(WebKitWebView		*view,
+@@ -560,17 +565,33 @@ static void over_link_cb(WebKitWebView *view, const gchar *wtf,
+ 	}
+ }
+ 
+-static void load_progress_cb(WebKitWebView *view, gint progress,
++static void load_progress_cb(WebKitWebView *view, GParamSpec* pspec,
+ 			     FancyViewer *viewer)
+ {
+-	gdouble pbar;
+-	gchar *label = g_strdup_printf("%d%% Loading...", progress);
+-	pbar = (gdouble) progress / 100;
++	WebKitLoadStatus status = webkit_web_view_get_load_status(viewer->view);
++	gdouble pbar = webkit_web_view_get_progress(viewer->view);
++	const gchar *uri = webkit_web_view_get_uri(viewer->view);
++
++	gchar *label = g_strdup_printf("%d%% Loading...", (gint)(pbar * 100));
+ 	gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(viewer->progress), pbar);
+ 	gtk_progress_bar_set_text(GTK_PROGRESS_BAR(viewer->progress),
+ 				  (const gchar*)label);
+ 	g_free(label);
++
++	switch (status) {
++		case WEBKIT_LOAD_PROVISIONAL:
++		case WEBKIT_LOAD_COMMITTED:
++		case WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT:
++			break;
++		case WEBKIT_LOAD_FAILED:
++			debug_print("Load failed: %s\n", uri);
++			break;
++		case WEBKIT_LOAD_FINISHED:
++			debug_print("Load finished: %s\n", uri);
++			break;
++	}
+ }
++
+ static void stop_loading_cb(GtkWidget *widget, GdkEvent *ev,
+ 							FancyViewer *viewer)
+ {
+@@ -594,11 +615,8 @@ static void search_the_web_cb(GtkWidget *widget, FancyViewer *viewer)
+ 		gchar *tmp = webkit_web_view_get_selected_text(viewer->view);
+ #endif
+ 		search = g_strconcat(GOOGLE_SEARCH, tmp, NULL);
+-#if WEBKIT_CHECK_VERSION(1,1,1)
++
+ 		webkit_web_view_load_uri(viewer->view, search);
+-#else
+-		webkit_web_view_open(viewer->view, search);
+-#endif
+ 		g_free(search);
+ 		g_free(tmp);
+ 	}
+@@ -893,6 +911,17 @@ static void zoom_out_cb(GtkWidget *widget, GdkEvent *ev, FancyViewer *viewer)
+ 	webkit_web_view_zoom_out(viewer->view);
+ }
+ 
++#if WEBKIT_CHECK_VERSION (1,7,5)
++static void resource_load_failed_cb(WebKitWebView     *web_view,
++				    WebKitWebFrame    *web_frame,
++				    WebKitWebResource *web_resource,
++				    GError            *error,
++				    FancyViewer	      *viewer)
++{
++	debug_print("Loading error: %s\n", error->message);
++}
++#endif
++
+ static MimeViewer *fancy_viewer_create(void)
+ {
+ 	FancyViewer    *viewer;
+@@ -1009,10 +1038,15 @@ static MimeViewer *fancy_viewer_create(void)
+ 			 G_CALLBACK(load_finished_cb), viewer);
+ 	g_signal_connect(G_OBJECT(viewer->view), "hovering-over-link",
+ 			 G_CALLBACK(over_link_cb), viewer);
+-	g_signal_connect(G_OBJECT(viewer->view), "load-progress-changed",
++
++	g_signal_connect(G_OBJECT(viewer->view), "notify::progress",
++			 G_CALLBACK(load_progress_cb), viewer);
++	g_signal_connect(G_OBJECT(viewer->view), "notify::load-status",
+ 			 G_CALLBACK(load_progress_cb), viewer);
+-	g_signal_connect(G_OBJECT(viewer->view), "navigation-requested",
+-			 G_CALLBACK(navigation_requested_cb), viewer);
++
++	g_signal_connect(G_OBJECT(viewer->view), "navigation-policy-decision-requested",
++			 G_CALLBACK(navigation_policy_cb), viewer);
++
+ 	g_signal_connect(G_OBJECT(viewer->view), "resource-request-starting",
+ 			G_CALLBACK(resource_request_starting_cb), viewer);
+ 	g_signal_connect(G_OBJECT(viewer->view), "populate-popup",
+@@ -1034,6 +1068,11 @@ static MimeViewer *fancy_viewer_create(void)
+ 	g_signal_connect(G_OBJECT(viewer->view), "key_press_event",
+ 			 G_CALLBACK(keypress_events_cb), viewer);
+ 
++#if WEBKIT_CHECK_VERSION (1,7,5)
++	g_signal_connect(G_OBJECT(viewer->view), "resource-load-failed",
++			 G_CALLBACK(resource_load_failed_cb), viewer);
++#endif
++
+ 	viewer->filename = NULL;
+ 	return (MimeViewer *) viewer;
+ }
+diff --git src/plugins/fancy/fancy_viewer.h src/plugins/fancy/fancy_viewer.h
+index 4d751b712..952b33717 100644
+--- src/plugins/fancy/fancy_viewer.h
++++ src/plugins/fancy/fancy_viewer.h
+@@ -33,6 +33,8 @@
+ #include <webkit/webkitversion.h>
+ #include <webkit/webkitwebframe.h>
+ #include <webkit/webkitnetworkrequest.h>
++#include <webkit/webkitwebnavigationaction.h>
++#include <webkit/webkitwebpolicydecision.h>
+ #if WEBKIT_CHECK_VERSION (1,3,10)
+ #include <webkit/webkitglobals.h>
+ #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706161846.v5GIkjA7006699>