[Commits] [SCM] claws branch, master, updated. 3.12.0-47-gc1172c5

Colin colin at claws-mail.org
Tue Aug 11 14:44:31 CEST 2015


The branch, master has been updated
       via  c1172c548a18b4161b965b57371239ca38e2c565 (commit)
       via  f04aaa4cb1ed092b76bf60190a3d8f8cdcafed9e (commit)
      from  229e17d5b79d25bb0657c6b985af15ca15058356 (commit)

Summary of changes:
 src/textview.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit c1172c548a18b4161b965b57371239ca38e2c565
Merge: f04aaa4 229e17d
Author: Colin Leroy <colin at colino.net>
Date:   Tue Aug 11 14:45:08 2015 +0200

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


commit f04aaa4cb1ed092b76bf60190a3d8f8cdcafed9e
Author: Colin Leroy <colin at colino.net>
Date:   Tue Aug 11 14:43:23 2015 +0200

    Save temporary file in mime temporary directory when using right-click/Open image instead of saving in current working directory.
    Also, save in home directory if attach_save_dir is not set.

diff --git a/src/textview.c b/src/textview.c
index e65b1d7..d7420b5 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -2942,7 +2942,7 @@ static void open_image_cb (GtkAction *action, TextView *textview)
 	gchar *cmd = NULL;
 	gchar buf[1024];
 	const gchar *p;
-	gchar *filename = NULL;
+	gchar *filename = NULL, *filepath = NULL;
 	gchar *tmp_filename = NULL;
 
 	if (uri == NULL)
@@ -2961,8 +2961,11 @@ static void open_image_cb (GtkAction *action, TextView *textview)
 
 	subst_for_filename(filename);
 
+	filepath = g_strconcat(get_mime_tmp_dir(), G_DIR_SEPARATOR_S,
+			       filename, NULL);
+
 	tmp_filename = g_filename_from_uri(uri->uri, NULL, NULL);
-	copy_file(tmp_filename, filename, FALSE);
+	copy_file(tmp_filename, filepath, FALSE);
 	g_free(tmp_filename);
 
 	cmd = mailcap_get_command_for_type("image/jpeg", filename);
@@ -2981,14 +2984,17 @@ static void open_image_cb (GtkAction *action, TextView *textview)
 	}
 	if (cmd && (p = strchr(cmd, '%')) && *(p + 1) == 's' &&
 	    !strchr(p + 2, '%'))
-		g_snprintf(buf, sizeof(buf), cmd, filename);
+		g_snprintf(buf, sizeof(buf), cmd, filepath);
 	else {
 		g_warning("Image viewer command-line is invalid: '%s'", cmd);
+		g_free(filepath);
+		g_free(filename);
 		return;
 	}
 
 	execute_command_line(buf, TRUE);
 
+	g_free(filepath);
 	g_free(filename);
 	g_free(cmd);
 
@@ -3026,7 +3032,8 @@ static void save_file_cb (GtkAction *action, TextView *textview)
 		filepath = g_strconcat(prefs_common.attach_save_dir,
 				       G_DIR_SEPARATOR_S, filename, NULL);
 	else
-		filepath = g_strdup(filename);
+		filepath = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
+				       filename, NULL);
 
 	g_free(filename);
 

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list