[Commits] [SCM] claws branch, master, updated. 3.15.0-70-g7b57300

Colin colin at claws-mail.org
Sun Jun 18 21:47:03 CEST 2017


The branch, master has been updated
       via  7b573007cd8be18dc7ce792cd3f03f6201592743 (commit)
       via  f075b5064e96a9fdcc8e666c8e65f0242dabf5ff (commit)
      from  d0cd54152fa784f31fa3d01e80cc4f20eb2d2d6f (commit)

Summary of changes:
 src/plugins/fancy/fancy_viewer.c |   34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)


- Log -----------------------------------------------------------------
commit 7b573007cd8be18dc7ce792cd3f03f6201592743
Merge: f075b50 d0cd541
Author: Colin Leroy <colin at colino.net>
Date:   Sun Jun 18 21:46:58 2017 +0200

    Merge branch 'master' of ssh://git.claws-mail.org/home/git/claws


commit f075b5064e96a9fdcc8e666c8e65f0242dabf5ff
Author: Colin Leroy <colin at colino.net>
Date:   Sun Jun 18 21:46:08 2017 +0200

    Fix Toggling of preferences leaving empty view
    Webkit can't apparently reload when it loaded a string.

diff --git a/src/plugins/fancy/fancy_viewer.c b/src/plugins/fancy/fancy_viewer.c
index 079a18e..990cb9d 100644
--- a/src/plugins/fancy/fancy_viewer.c
+++ b/src/plugins/fancy/fancy_viewer.c
@@ -68,6 +68,7 @@ static size_t download_file_curl_write_cb(void *buffer, size_t size,
 					  size_t nmemb, void *data);
 static void *download_file_curl (void *data);
 static void download_file_cb(GtkWidget *widget, FancyViewer *viewer);
+static gboolean fancy_set_contents(FancyViewer *viewer, gboolean use_defaults);
 
 #if !WEBKIT_CHECK_VERSION (1,5,1)
 gchar* webkit_web_view_get_selected_text(WebKitWebView* web_view);
@@ -106,31 +107,31 @@ static void fancy_apply_prefs(FancyViewer *viewer)
 static void fancy_auto_load_images_activated(GtkCheckMenuItem *item, FancyViewer *viewer) {
 	viewer->override_prefs_images = gtk_check_menu_item_get_active(item);
 	fancy_apply_prefs(viewer);
-	webkit_web_view_reload (viewer->view);
+	fancy_set_contents(viewer, FALSE);
 }
 
 static void fancy_enable_remote_content_activated(GtkCheckMenuItem *item, FancyViewer *viewer) {
 	viewer->override_prefs_remote_content = gtk_check_menu_item_get_active(item);
 	fancy_apply_prefs(viewer);
-	webkit_web_view_reload (viewer->view);
+	fancy_set_contents(viewer, FALSE);
 }
 
 static void fancy_enable_scripts_activated(GtkCheckMenuItem *item, FancyViewer *viewer) {
 	viewer->override_prefs_scripts = gtk_check_menu_item_get_active(item);
 	fancy_apply_prefs(viewer);
-	webkit_web_view_reload (viewer->view);
+	fancy_set_contents(viewer, FALSE);
 }
 
 static void fancy_enable_plugins_activated(GtkCheckMenuItem *item, FancyViewer *viewer) {
 	viewer->override_prefs_plugins = gtk_check_menu_item_get_active(item);
 	fancy_apply_prefs(viewer);
-	webkit_web_view_reload (viewer->view);
+	fancy_set_contents(viewer, FALSE);
 }
 
 static void fancy_enable_java_activated(GtkCheckMenuItem *item, FancyViewer *viewer) {
 	viewer->override_prefs_java = gtk_check_menu_item_get_active(item);
 	fancy_apply_prefs(viewer);
-	webkit_web_view_reload (viewer->view);
+	fancy_set_contents(viewer, FALSE);
 }
 
 static void fancy_open_external_activated(GtkCheckMenuItem *item, FancyViewer *viewer) {
@@ -196,9 +197,8 @@ static void fancy_set_defaults(FancyViewer *viewer)
 	fancy_apply_prefs(viewer);
 }
 
-static gboolean fancy_show_mimepart_real(MimeViewer *_viewer)
+static gboolean fancy_set_contents(FancyViewer *viewer, gboolean use_defaults)
 {
-	FancyViewer *viewer = (FancyViewer *) _viewer;
 	MessageView *messageview = ((MimeViewer *)viewer)->mimeview
 					? ((MimeViewer *)viewer)->mimeview->messageview
 					: NULL;
@@ -230,7 +230,7 @@ static gboolean fancy_show_mimepart_real(MimeViewer *_viewer)
 		const gchar *charset = NULL;
 		gchar *contents = NULL;
 		if (messageview && messageview->forced_charset)
-			charset = _viewer->mimeview->messageview->forced_charset;
+			charset = ((MimeViewer *)viewer)->mimeview->messageview->forced_charset;
 		else
 			charset = procmime_mimeinfo_get_parameter(partinfo, "charset");
 		if (!charset)
@@ -238,13 +238,14 @@ static gboolean fancy_show_mimepart_real(MimeViewer *_viewer)
 		debug_print("using %s charset\n", charset);
 		g_object_set(viewer->settings, "default-encoding", charset, 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));
+		if (use_defaults) {
+			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_set_defaults(viewer);
+		}
 
+		contents = file_read_to_str_no_recode(viewer->filename);
 		webkit_web_view_load_string(viewer->view,
 					    contents,
 					    "text/html",
@@ -255,10 +256,17 @@ static gboolean fancy_show_mimepart_real(MimeViewer *_viewer)
 	viewer->loading = FALSE;
 	return FALSE;
 }
+
+static gboolean fancy_show_mimepart_real(MimeViewer *_viewer)
+{
+	return fancy_set_contents((FancyViewer *)_viewer, TRUE);
+}
+
 static void fancy_show_notice(FancyViewer *viewer, const gchar *message)
 {
 	gtk_label_set_text(GTK_LABEL(viewer->l_link), message);
 }
+
 static gint fancy_show_mimepart_prepare(MimeViewer *_viewer)
 {
 	FancyViewer *viewer = (FancyViewer *) _viewer;

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list