[Commits] [SCM] claws branch, master, updated. 3.17.3-191-g098ecbb

Colin colin at claws-mail.org
Sun Jul 7 10:52:21 CEST 2019


The branch, master has been updated
       via  098ecbb93756aee7147878a8ff457c9063faed5b (commit)
       via  66fccde959a1b4addee971412b35d4b51d8272b1 (commit)
       via  42eaffb250b3f53712e2be0eb7a5b8d26cfc7c10 (commit)
       via  23b4352cb9f4339977c5b5a7604b80c23dca3623 (commit)
      from  84072413a8bda62e89537b4ca3fec7b980a09cef (commit)

Summary of changes:
 src/compose.c                             |  240 ++++++++++++++++++++++-------
 src/image_viewer.c                        |    7 +-
 src/mimeview.c                            |   38 +++++
 src/plugins/litehtml_viewer/lh_widget.cpp |   15 +-
 src/procmime.c                            |   30 +++-
 src/procmime.h                            |    5 +-
 src/textview.c                            |   13 +-
 7 files changed, 256 insertions(+), 92 deletions(-)


- Log -----------------------------------------------------------------
commit 098ecbb93756aee7147878a8ff457c9063faed5b
Author: Colin Leroy <colin at colino.net>
Date:   Sun Jul 7 10:51:55 2019 +0200

    litehtml_viewer: use new procmime_get_part_as_pixbuf helper function

diff --git a/src/plugins/litehtml_viewer/lh_widget.cpp b/src/plugins/litehtml_viewer/lh_widget.cpp
index 30b6fb8..903c496 100644
--- a/src/plugins/litehtml_viewer/lh_widget.cpp
+++ b/src/plugins/litehtml_viewer/lh_widget.cpp
@@ -451,17 +451,9 @@ GdkPixbuf *lh_widget::get_local_image(const litehtml::tstring url) const
 				strlen(p->id) >= len + 2 &&
 				!strncasecmp(name, p->id + 1, len) &&
 				*(p->id + len + 1) == '>') {
-			GInputStream *stream;
 			GError *error = NULL;
 
-			stream = procmime_get_part_as_inputstream(p);
-			if (stream == NULL) {
-				g_warning("Could not decode MIME part\n");
-				return NULL;
-			}
-
-			pixbuf = gdk_pixbuf_new_from_stream(stream, NULL, &error);
-			g_object_unref(stream);
+			pixbuf = procmime_get_part_as_pixbuf(p, &error);
 			if (error != NULL) {
 				g_warning("Couldn't load image: %s\n", error->message);
 				g_error_free(error);

commit 66fccde959a1b4addee971412b35d4b51d8272b1
Author: Colin Leroy <colin at colino.net>
Date:   Sun Jul 7 10:43:45 2019 +0200

    Compose: handle pasted images and text/uri-list (files) and attach them

diff --git a/src/compose.c b/src/compose.c
index 3657a11..addc6f3 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -10897,58 +10897,196 @@ static void entry_copy_clipboard(GtkWidget *entry)
 			gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));
 }
 
+static void paste_text(Compose *compose, GtkWidget *entry,
+		       gboolean wrap, GdkAtom clip, GtkTextIter *insert_place,
+		       const gchar *contents)
+{
+	GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry));
+	GtkTextMark *mark_start = gtk_text_buffer_get_insert(buffer);
+	GtkTextIter start_iter, end_iter;
+	gint start, end;
+
+	if (contents == NULL)
+		return;
+
+	/* we shouldn't delete the selection when middle-click-pasting, or we
+	 * can't mid-click-paste our own selection */
+	if (clip != GDK_SELECTION_PRIMARY) {
+		undo_paste_clipboard(GTK_TEXT_VIEW(compose->text), compose->undostruct);
+		gtk_text_buffer_delete_selection(buffer, FALSE, TRUE);
+	}
+
+	if (insert_place == NULL) {
+		/* if insert_place isn't specified, insert at the cursor.
+		 * used for Ctrl-V pasting */
+		gtk_text_buffer_get_iter_at_mark(buffer, &start_iter, mark_start);
+		start = gtk_text_iter_get_offset(&start_iter);
+		gtk_text_buffer_insert(buffer, &start_iter, contents, strlen(contents));
+	} else {
+		/* if insert_place is specified, paste here.
+		 * used for mid-click-pasting */
+		start = gtk_text_iter_get_offset(insert_place);
+		gtk_text_buffer_insert(buffer, insert_place, contents, strlen(contents));
+		if (prefs_common.primary_paste_unselects)
+			gtk_text_buffer_select_range(buffer, insert_place, insert_place);
+	}
+
+	if (!wrap) {
+		/* paste unwrapped: mark the paste so it's not wrapped later */
+		end = start + strlen(contents);
+		gtk_text_buffer_get_iter_at_offset(buffer, &start_iter, start);
+		gtk_text_buffer_get_iter_at_offset(buffer, &end_iter, end);
+		gtk_text_buffer_apply_tag_by_name(buffer, "no_wrap", &start_iter, &end_iter);
+	} else if (wrap && clip == GDK_SELECTION_PRIMARY) {
+		/* rewrap paragraph now (after a mid-click-paste) */
+		mark_start = gtk_text_buffer_get_insert(buffer);
+		gtk_text_buffer_get_iter_at_mark(buffer, &start_iter, mark_start);
+		gtk_text_iter_backward_char(&start_iter);
+		compose_beautify_paragraph(compose, &start_iter, TRUE);
+	}
+	compose->modified = TRUE;
+}
+
+static void attach_uri_list(Compose *compose, GtkSelectionData *data)
+{
+	GList *list, *tmp;
+	int att = 0;
+	gchar *warn_files = NULL;
+
+	list = uri_list_extract_filenames(
+		(const gchar *)gtk_selection_data_get_data(data));
+	for (tmp = list; tmp != NULL; tmp = tmp->next) {
+		gchar *utf8_filename = conv_filename_to_utf8((const gchar *)tmp->data);
+		gchar *tmp_f = g_strdup_printf("%s%s\n",
+				warn_files?warn_files:"",
+				utf8_filename);
+		g_free(warn_files);
+		warn_files = tmp_f;
+		att++;
+		compose_attach_append
+			(compose, (const gchar *)tmp->data,
+			 utf8_filename, NULL, NULL);
+		g_free(utf8_filename);
+	}
+	if (list) {
+		compose_changed_cb(NULL, compose);
+		alertpanel_notice(ngettext(
+			"The following file has been attached: \n%s",
+			"The following files have been attached: \n%s", att), warn_files);
+		g_free(warn_files);
+	}
+	list_free_strings_full(list);
+}
+
+int attach_image(Compose *compose, GtkSelectionData *data, const gchar *subtype)
+{
+	FILE *fp;
+	const guchar *contents;
+	gchar *file;
+	gchar *type;
+	size_t len;
+	int r;
+
+	cm_return_val_if_fail(data != NULL, -1);
+
+	contents = gtk_selection_data_get_data(data);
+	len = gtk_selection_data_get_length(data);
+
+	file = g_strconcat(get_tmp_file(), "-image.", subtype, NULL);
+
+	debug_print("writing image to %s\n", file);
+
+	if ((fp = claws_fopen(file, "wb")) == NULL) {
+		FILE_OP_ERROR(file, "claws_fopen");
+		return -1;
+	}
+
+	if (claws_fwrite(contents, 1, len, fp) != len) {
+		FILE_OP_ERROR(file, "claws_fwrite");
+		claws_fclose(fp);
+		claws_unlink(file);
+		return -1;
+	}
+
+	r = claws_safe_fclose(fp);
+
+	if (r == EOF) {
+		FILE_OP_ERROR(file, "claws_fclose");
+		claws_unlink(file);
+		return -1;
+	}
+
+	type = g_strconcat("image/", subtype, NULL);
+
+	compose_attach_append(compose, (const gchar *)file, 
+		(const gchar *)file, type, NULL);
+
+	alertpanel_notice(_("The pasted image has been attached as: \n%s"), file);
+
+	g_free(file);
+	g_free(type);
+
+	return 0;
+}
+
 static void entry_paste_clipboard(Compose *compose, GtkWidget *entry, 
 				  gboolean wrap, GdkAtom clip, GtkTextIter *insert_place)
 {
 	if (GTK_IS_TEXT_VIEW(entry)) {
-		GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry));
-		GtkTextMark *mark_start = gtk_text_buffer_get_insert(buffer);
-		GtkTextIter start_iter, end_iter;
-		gint start, end;
-		gchar *contents = gtk_clipboard_wait_for_text(gtk_clipboard_get(clip));
+		GdkAtom types = gdk_atom_intern ("TARGETS", FALSE);
+		GdkAtom *targets = NULL;
+		int n_targets = 0, i;
+		gboolean paste_done = FALSE;
+		GtkClipboard *clipboard = gtk_clipboard_get(clip);
+
+		GtkSelectionData *contents = gtk_clipboard_wait_for_contents(
+						clipboard, types);
+
+		if (contents != NULL) {
+			gtk_selection_data_get_targets(contents, &targets, &n_targets);
+			gtk_selection_data_free(contents);
+		}
+
+		for (i = 0; i < n_targets; i++) {
+			GdkAtom atom = targets[i];
+			gchar *atom_type = gdk_atom_name(atom);
+
+			if (atom_type != NULL) {
+				GtkSelectionData *data = gtk_clipboard_wait_for_contents(
+						clipboard, atom);
+				debug_print("got contents of type %s\n", atom_type);
+				if (!strcmp(atom_type, "text/plain")) {
+					/* let the default text handler handle it */
+                    break;
+				} else if (!strcmp(atom_type, "text/uri-list")) {
+					attach_uri_list(compose, data);
+
+					paste_done = TRUE;
+					break;
+				} else if (!strncmp(atom_type, "image/", strlen("image/"))) {
+					gchar *subtype = g_strdup((gchar *)(strstr(atom_type, "/")+1));
+					debug_print("image of type %s\n", subtype);
 
-		if (contents == NULL)
-			return;
-	
-		/* we shouldn't delete the selection when middle-click-pasting, or we
-		 * can't mid-click-paste our own selection */
-		if (clip != GDK_SELECTION_PRIMARY) {
-			undo_paste_clipboard(GTK_TEXT_VIEW(compose->text), compose->undostruct);
-			gtk_text_buffer_delete_selection(buffer, FALSE, TRUE);
-		}
-		
-		if (insert_place == NULL) {
-			/* if insert_place isn't specified, insert at the cursor.
-			 * used for Ctrl-V pasting */
-			gtk_text_buffer_get_iter_at_mark(buffer, &start_iter, mark_start);
-			start = gtk_text_iter_get_offset(&start_iter);
-			gtk_text_buffer_insert(buffer, &start_iter, contents, strlen(contents));
-		} else {
-			/* if insert_place is specified, paste here.
-			 * used for mid-click-pasting */
-			start = gtk_text_iter_get_offset(insert_place);
-			gtk_text_buffer_insert(buffer, insert_place, contents, strlen(contents));
-			if (prefs_common.primary_paste_unselects)
-				gtk_text_buffer_select_range(buffer, insert_place, insert_place);
+					attach_image(compose, data, subtype);
+					g_free(subtype);
+
+					paste_done = TRUE;
+					break;
+				}
+			}
 		}
-		
-		if (!wrap) {
-			/* paste unwrapped: mark the paste so it's not wrapped later */
-			end = start + strlen(contents);
-			gtk_text_buffer_get_iter_at_offset(buffer, &start_iter, start);
-			gtk_text_buffer_get_iter_at_offset(buffer, &end_iter, end);
-			gtk_text_buffer_apply_tag_by_name(buffer, "no_wrap", &start_iter, &end_iter);
-		} else if (wrap && clip == GDK_SELECTION_PRIMARY) {
-			/* rewrap paragraph now (after a mid-click-paste) */
-			mark_start = gtk_text_buffer_get_insert(buffer);
-			gtk_text_buffer_get_iter_at_mark(buffer, &start_iter, mark_start);
-			gtk_text_iter_backward_char(&start_iter);
-			compose_beautify_paragraph(compose, &start_iter, TRUE);
+		if (!paste_done) {
+			gchar *def_text = gtk_clipboard_wait_for_text(clipboard);
+			paste_text(compose, entry, wrap, clip,
+				   insert_place, def_text);
+			g_free(def_text);
 		}
-	} else if (GTK_IS_EDITABLE(entry))
-		gtk_editable_paste_clipboard (GTK_EDITABLE(entry));
+		g_free(targets);
 
-	compose->modified = TRUE;
+	} else if (GTK_IS_EDITABLE(entry)) {
+		gtk_editable_paste_clipboard (GTK_EDITABLE(entry));
+		compose->modified = TRUE;
+	}
 }
 
 static void entry_allsel(GtkWidget *entry)
@@ -11608,25 +11746,13 @@ static void compose_attach_drag_received_cb (GtkWidget		*widget,
 					     gpointer		 user_data)
 {
 	Compose *compose = (Compose *)user_data;
-	GList *list, *tmp;
 	GdkAtom type;
 
 	type = gtk_selection_data_get_data_type(data);
 	if ((gdk_atom_name(type) && !strcmp(gdk_atom_name(type), "text/uri-list"))
 	   && gtk_drag_get_source_widget(context) !=
 	        summary_get_main_widget(mainwindow_get_mainwindow()->summaryview)) {
-		list = uri_list_extract_filenames(
-			(const gchar *)gtk_selection_data_get_data(data));
-		for (tmp = list; tmp != NULL; tmp = tmp->next) {
-			gchar *utf8_filename = conv_filename_to_utf8((const gchar *)tmp->data);
-			compose_attach_append
-				(compose, (const gchar *)tmp->data,
-				 utf8_filename, NULL, NULL);
-			g_free(utf8_filename);
-		}
-		if (list)
-			compose_changed_cb(NULL, compose);
-		list_free_strings_full(list);
+		attach_uri_list(compose, data);
 	} else if (gtk_drag_get_source_widget(context)
 		   == summary_get_main_widget(mainwindow_get_mainwindow()->summaryview)) {
 		/* comes from our summaryview */

commit 42eaffb250b3f53712e2be0eb7a5b8d26cfc7c10
Author: Colin Leroy <colin at colino.net>
Date:   Sun Jul 7 10:40:15 2019 +0200

    Implement copying of attached images to clipboard

diff --git a/src/mimeview.c b/src/mimeview.c
index 7e28330..fe840f5 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -157,6 +157,33 @@ static void mimeview_open_with_cb(GtkAction *action, gpointer data)
 }
 #endif
 
+static void mimeview_copy_cb(GtkAction *action, gpointer data)
+{
+	MimeView *mimeview = (MimeView *)data;
+	MimeInfo *mimeinfo = mimeview_get_part_to_use(mimeview);
+
+	if (mimeinfo == NULL)
+		return;
+
+	if (mimeinfo->type == MIMETYPE_IMAGE) {
+		GError *error = NULL;
+		GdkPixbuf *pixbuf = procmime_get_part_as_pixbuf(mimeinfo, &error);
+		if (error != NULL) {
+			g_warning("could not copy: %s", error->message);
+			g_error_free(error);
+		} else {
+			gtk_clipboard_set_image(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD),
+						pixbuf);
+		}
+		g_object_unref(pixbuf);
+	} else {
+		void *data = procmime_get_part_as_string(mimeinfo, FALSE);
+		gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD),
+				       data, mimeinfo->length);
+		g_free(data);
+	}
+}
+
 static void mimeview_send_to_cb(GtkAction *action, gpointer data)
 {
 	MimeView *mimeview = (MimeView *)data;	
@@ -194,6 +221,7 @@ static GtkActionEntry mimeview_menu_actions[] = {
 #if (!defined G_OS_WIN32)
 	{ "MimeView/OpenWith", NULL, N_("Open _with..."), NULL, "Open MIME part with...", G_CALLBACK(mimeview_open_with_cb) },
 #endif
+	{ "MimeView/Copy", NULL, N_("Copy"), NULL, "Copy", G_CALLBACK(mimeview_copy_cb) },
 	{ "MimeView/SendTo", NULL, N_("Send to..."), NULL, "Send to", G_CALLBACK(mimeview_send_to_cb) },
 	{ "MimeView/DisplayAsText", NULL, N_("_Display as text"), NULL, "Display as text", G_CALLBACK(mimeview_display_as_text_cb) },
 	{ "MimeView/SaveAs", NULL, N_("_Save as..."), NULL, "Save as", G_CALLBACK(mimeview_save_as_cb) },
@@ -400,6 +428,9 @@ MimeView *mimeview_create(MainWindow *mainwin)
 			GTK_UI_MANAGER_MENUITEM);
 #endif
 	MENUITEM_ADDUI_MANAGER(mimeview->ui_manager, 
+			"/Menus/MimeView/", "Copy", "MimeView/Copy",
+			GTK_UI_MANAGER_MENUITEM);
+	MENUITEM_ADDUI_MANAGER(mimeview->ui_manager,
 			"/Menus/MimeView/", "SendTo", "MimeView/SendTo",
 			GTK_UI_MANAGER_MENUITEM);
 	MENUITEM_ADDUI_MANAGER(mimeview->ui_manager, 
@@ -1519,6 +1550,13 @@ static gboolean part_button_pressed(MimeView *mimeview, GdkEventButton *event,
 			cm_menu_set_sensitive_full(mimeview->ui_manager, "Menus/MimeView/DisplayAsText", FALSE);
 		else
 			cm_menu_set_sensitive_full(mimeview->ui_manager, "Menus/MimeView/DisplayAsText", TRUE);
+
+		if (partinfo && (partinfo->type == MIMETYPE_MESSAGE ||
+				 partinfo->type == MIMETYPE_IMAGE ||
+				 partinfo->type == MIMETYPE_TEXT))
+			cm_menu_set_sensitive_full(mimeview->ui_manager, "Menus/MimeView/Copy", TRUE);
+		else
+			cm_menu_set_sensitive_full(mimeview->ui_manager, "Menus/MimeView/Copy", FALSE);
 #ifndef G_OS_WIN32
 		if (partinfo &&
 		    partinfo->type == MIMETYPE_APPLICATION &&
diff --git a/src/procmime.c b/src/procmime.c
index a146339..1f126ec 100644
--- a/src/procmime.c
+++ b/src/procmime.c
@@ -2724,9 +2724,10 @@ GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo)
 	cm_return_val_if_fail(mimeinfo != NULL, NULL);
 
 	if (mimeinfo->encoding_type != ENC_BINARY &&
-			!procmime_decode_content(mimeinfo))
+			!procmime_decode_content(mimeinfo)) {
+		g_warning("could not decode part");
 		return NULL;
-
+	}
 	if (mimeinfo->content == MIMECONTENT_MEM) {
 		/* NULL for destroy func, since we're not copying
 		 * the data for the stream. */
@@ -2739,3 +2740,25 @@ GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo)
 				mimeinfo->length, g_free);
 	}
 }
+
+GdkPixbuf *procmime_get_part_as_pixbuf(MimeInfo *mimeinfo, GError **error)
+{
+	GdkPixbuf *pixbuf;
+	GInputStream *stream;
+
+	*error = NULL;
+
+	stream = procmime_get_part_as_inputstream(mimeinfo);
+	if (stream == NULL) {
+		return NULL;
+	}
+
+	pixbuf = gdk_pixbuf_new_from_stream(stream, NULL, error);
+	g_object_unref(stream);
+
+	if (*error != NULL) {
+		return NULL;
+	}
+	return pixbuf;
+}
+
diff --git a/src/procmime.h b/src/procmime.h
index 5749e6f..e87a276 100644
--- a/src/procmime.h
+++ b/src/procmime.h
@@ -25,6 +25,7 @@
 #endif
 
 #include <gio/gio.h>
+#include <gtk/gtk.h>
 
 #include "utils.h"
 #include "proctypes.h"
@@ -244,6 +245,7 @@ gboolean procmime_scan_text_content(MimeInfo *mimeinfo,
 void *procmime_get_part_as_string(MimeInfo *mimeinfo,
 		gboolean null_terminate);
 GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo);
+GdkPixbuf *procmime_get_part_as_pixbuf(MimeInfo *mimeinfo, GError **error);
 
 #ifdef __cplusplus
 }
diff --git a/src/textview.c b/src/textview.c
index 88c0aa1..5576003 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -722,22 +722,14 @@ static void textview_add_part(TextView *textview, MimeInfo *mimeinfo)
 
 			START_TIMING("inserting image");
 
-			stream = procmime_get_part_as_inputstream(mimeinfo);
-			if (stream == NULL) {
-				g_warning("Can't get the image file");
-				END_TIMING();
-				return;
-			}
-
-			pixbuf = gdk_pixbuf_new_from_stream(stream, NULL, &error);
-			g_object_unref(stream);
-
+			pixbuf = procmime_get_part_as_pixbuf(mimeinfo, &error);
 			if (error != NULL) {
 				g_warning("Can't load the image: %s\n", error->message);
 				g_error_free(error);
 				END_TIMING();
 				return;
 			}
+
 			if (textview->stop_loading) {
 				END_TIMING();
 				return;

commit 23b4352cb9f4339977c5b5a7604b80c23dca3623
Author: Colin Leroy <colin at colino.net>
Date:   Sun Jul 7 10:31:01 2019 +0200

    procmime_get_part_as_inputstream doesn't touch error, so remove it

diff --git a/src/image_viewer.c b/src/image_viewer.c
index a9eea66..c37fd22 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -82,10 +82,9 @@ static void image_viewer_load_image(ImageViewer *imageviewer)
 	if (imageviewer->mimeinfo == NULL)
 		return;
 
-	stream = procmime_get_part_as_inputstream(imageviewer->mimeinfo, &error);
-	if (error != NULL) {
-		g_warning("Couldn't get image MIME part: %s\n", error->message);
-		g_error_free(error);
+	stream = procmime_get_part_as_inputstream(imageviewer->mimeinfo);
+	if (stream == NULL) {
+		g_warning("Couldn't get image MIME part");
 		return;
 	}
 
diff --git a/src/plugins/litehtml_viewer/lh_widget.cpp b/src/plugins/litehtml_viewer/lh_widget.cpp
index 8e8e808..30b6fb8 100644
--- a/src/plugins/litehtml_viewer/lh_widget.cpp
+++ b/src/plugins/litehtml_viewer/lh_widget.cpp
@@ -454,14 +454,9 @@ GdkPixbuf *lh_widget::get_local_image(const litehtml::tstring url) const
 			GInputStream *stream;
 			GError *error = NULL;
 
-			stream = procmime_get_part_as_inputstream(p, &error);
-			if (error != NULL || stream == NULL) {
-				if (error != NULL) {
-					g_warning("Couldn't get image MIME part: %s\n", error->message);
-					g_error_free(error);
-				} else {
-					g_warning("Could not decode MIME part\n");
-				}
+			stream = procmime_get_part_as_inputstream(p);
+			if (stream == NULL) {
+				g_warning("Could not decode MIME part\n");
 				return NULL;
 			}
 
diff --git a/src/procmime.c b/src/procmime.c
index a5961b7..a146339 100644
--- a/src/procmime.c
+++ b/src/procmime.c
@@ -2719,8 +2719,7 @@ void *procmime_get_part_as_string(MimeInfo *mimeinfo,
 
 /* Returns an open GInputStream. The caller should just
  * read mimeinfo->length bytes from it and then release it. */
-GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo,
-		GError **error)
+GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo)
 {
 	cm_return_val_if_fail(mimeinfo != NULL, NULL);
 
diff --git a/src/procmime.h b/src/procmime.h
index ac73447..5749e6f 100644
--- a/src/procmime.h
+++ b/src/procmime.h
@@ -243,8 +243,7 @@ gboolean procmime_scan_text_content(MimeInfo *mimeinfo,
 		gpointer cb_data);
 void *procmime_get_part_as_string(MimeInfo *mimeinfo,
 		gboolean null_terminate);
-GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo,
-		GError **error);
+GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo);
 
 #ifdef __cplusplus
 }
diff --git a/src/textview.c b/src/textview.c
index ee3c213..88c0aa1 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -722,10 +722,9 @@ static void textview_add_part(TextView *textview, MimeInfo *mimeinfo)
 
 			START_TIMING("inserting image");
 
-			stream = procmime_get_part_as_inputstream(mimeinfo, &error);
-			if (error != NULL) {
-				g_warning("Can't get the image file: %s", error->message);
-				g_error_free(error);
+			stream = procmime_get_part_as_inputstream(mimeinfo);
+			if (stream == NULL) {
+				g_warning("Can't get the image file");
 				END_TIMING();
 				return;
 			}

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list