[Commits] [SCM] claws branch, master, updated. 3.14.1-157-g18403c8

wwp at claws-mail.org wwp at claws-mail.org
Sat Jan 21 13:00:29 CET 2017


The branch, master has been updated
       via  18403c8b8b3da6086f29d69f49aad51c04f78967 (commit)
      from  a1b7175d0b29b3cc5aacc363537c83f7401d4c05 (commit)

Summary of changes:
 src/compose.c |   40 +++++++++++++++++++++-------------------
 src/compose.h |    2 +-
 2 files changed, 22 insertions(+), 20 deletions(-)


- Log -----------------------------------------------------------------
commit 18403c8b8b3da6086f29d69f49aad51c04f78967
Author: wwp <wwp at free.fr>
Date:   Sat Jan 21 12:58:50 2017 +0100

    Show attachments total size in compose window's relevant tab (only counts
    attachments size, not encoding or body part, it is not the email
    total size).

diff --git a/src/compose.c b/src/compose.c
index 21dae0c..2a2a438 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -3756,7 +3756,7 @@ static gboolean compose_attach_append(Compose *compose, const gchar *file,
 		g_free(file_from_uri);
 		if (result)
 			return TRUE;
-		alertpanel_error("File %s doesn't exist\n", filename);
+		alertpanel_error("File %s doesn't exist or permission denied\n", filename);
 		return FALSE;
 	}
 	if ((size = get_file_size(file)) < 0) {
@@ -6294,9 +6294,7 @@ static int compose_add_attachments(Compose *compose, MimeInfo *parent)
 	if (!gtk_tree_model_get_iter_first(model, &iter))
 		return 0;
 	do {
-		gtk_tree_model_get(model, &iter,
-				   COL_DATA, &ainfo,
-				   -1);
+		gtk_tree_model_get(model, &iter, COL_DATA, &ainfo, -1);
 		
 		if (!is_file_exist(ainfo->file)) {
 			gchar *msg = g_strdup_printf(_("Attachment %s doesn't exist anymore. Ignore?"), ainfo->file);
@@ -6325,11 +6323,11 @@ static int compose_add_attachments(Compose *compose, MimeInfo *parent)
 			type = g_strdup("application/octet-stream");
 		}
 
-    		subtype = strchr(type, '/') + 1;
-	        *(subtype - 1) = '\0';
-    		mimepart->type = procmime_get_media_type(type);
-    		mimepart->subtype = g_strdup(subtype);
-    		g_free(type);
+		subtype = strchr(type, '/') + 1;
+		*(subtype - 1) = '\0';
+		mimepart->type = procmime_get_media_type(type);
+		mimepart->subtype = g_strdup(subtype);
+		g_free(type);
 
 		if (mimepart->type == MIMETYPE_MESSAGE && 
 		    !g_ascii_strcasecmp(mimepart->subtype, "rfc822")) {
@@ -6367,8 +6365,6 @@ static int compose_add_attachments(Compose *compose, MimeInfo *parent)
 				ainfo->encoding = ENC_BASE64;
 		}
 
-		
-		
 		procmime_encode_content(mimepart, ainfo->encoding);
 
 		g_node_append(parent->node, mimepart->node);
@@ -9038,20 +9034,26 @@ static void compose_attach_update_label(Compose *compose)
 	gint i = 1;
 	gchar *text;
 	GtkTreeModel *model;
-	
-	if(compose == NULL)
+	goffset total_size;
+	AttachInfo *ainfo;
+
+	if (compose == NULL)
 		return;
-		
+
 	model = gtk_tree_view_get_model(GTK_TREE_VIEW(compose->attach_clist));
-	if(!gtk_tree_model_get_iter_first(model, &iter)) {
+	if (!gtk_tree_model_get_iter_first(model, &iter)) {
 		gtk_label_set_text(GTK_LABEL(compose->attach_label), "");	
 		return;
 	}
-	
-	while(gtk_tree_model_iter_next(model, &iter))
+
+	gtk_tree_model_get(model, &iter, COL_DATA, &ainfo, -1);
+	total_size = ainfo->size;
+	while(gtk_tree_model_iter_next(model, &iter)) {
+		gtk_tree_model_get(model, &iter, COL_DATA, &ainfo, -1);
+		total_size += ainfo->size;
 		i++;
-	
-	text = g_strdup_printf("(%d)", i);
+	}
+	text = g_strdup_printf(" (%d/%s)", i, to_human_readable(total_size));
 	gtk_label_set_text(GTK_LABEL(compose->attach_label), text);
 	g_free(text);
 }
diff --git a/src/compose.h b/src/compose.h
index c36fab8..cca482d 100644
--- a/src/compose.h
+++ b/src/compose.h
@@ -273,7 +273,7 @@ typedef enum
 } ComposeDraftAction;
 
 /*#warning FIXME_GTK2 */
-/* attache_files will be locale encode */
+/* attach_files will be locale encode */
 Compose *compose_new			(PrefsAccount	*account,
 				 	 const gchar	*mailto,
 				 	 GList		*attach_files);

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list