From b184f4255e03fad6800faea3f6c83edd500ebfd5 Mon Sep 17 00:00:00 2001 From: Thorsten Maerz Date: Sat, 22 Feb 2003 12:09:38 +0000 Subject: [PATCH] do not use description as attachment name --- ChangeLog.claws | 7 +++++++ configure.ac | 2 +- src/mimeview.c | 19 ++++++++++++++++++- src/prefs_common.c | 14 ++++++++++++++ src/prefs_common.h | 2 ++ src/procmime.c | 4 +--- src/procmime.h | 1 + 7 files changed, 44 insertions(+), 5 deletions(-) diff --git a/ChangeLog.claws b/ChangeLog.claws index 22af27d2e..a6c326454 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,10 @@ +2003-02-22 [thorsten] 0.8.10claws43 + + * src/mimeview.c + src/prefs_common.[ch] + src/procmime.[ch] + do not use description as attachment name + 2003-02-22 [alfons] 0.8.10claws42 * src/summaryview.c diff --git a/configure.ac b/configure.ac index 449f700d7..e61383d7d 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=8 MICRO_VERSION=10 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws42 +EXTRA_VERSION=claws43 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/mimeview.c b/src/mimeview.c index fd37a5202..3a65ed131 100644 --- a/src/mimeview.c +++ b/src/mimeview.c @@ -389,6 +389,20 @@ static gchar *get_part_name(MimeInfo *partinfo) return partinfo->name; else if (partinfo->filename) return partinfo->filename; + else if (partinfo->description) + return partinfo->description; + else + return ""; +} + +static gchar *get_part_description(MimeInfo *partinfo) +{ + if (partinfo->description) + return partinfo->description; + else if (partinfo->name) + return partinfo->name; + else if (partinfo->filename) + return partinfo->filename; else return ""; } @@ -404,7 +418,10 @@ static GtkCTreeNode *mimeview_append_part(MimeView *mimeview, str[COL_MIMETYPE] = partinfo->content_type ? partinfo->content_type : ""; str[COL_SIZE] = to_human_readable(partinfo->size); - str[COL_NAME] = get_part_name(partinfo); + if (prefs_common.attach_desc) + str[COL_NAME] = get_part_description(partinfo); + else + str[COL_NAME] = get_part_name(partinfo); node = gtk_ctree_insert_node(ctree, parent, NULL, str, 0, NULL, NULL, NULL, NULL, diff --git a/src/prefs_common.c b/src/prefs_common.c index 6e54dba85..c9da35ed5 100644 --- a/src/prefs_common.c +++ b/src/prefs_common.c @@ -189,6 +189,8 @@ static struct Message { GtkWidget *chkbtn_display_img; GtkWidget *chkbtn_resize_image; + + GtkWidget *chkbtn_attach_desc; } message; #if USE_GPGME @@ -692,6 +694,10 @@ static PrefParam param[] = { {"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL, NULL, NULL, NULL}, + {"attach_desc", "TRUE", &prefs_common.attach_desc, P_BOOL, + &message.chkbtn_attach_desc, + prefs_set_data_from_toggle, prefs_set_toggle}, + /* MIME viewer */ {"mime_image_viewer", "display '%s'", &prefs_common.mime_image_viewer, P_STRING, NULL, NULL, NULL}, @@ -2334,6 +2340,8 @@ static void prefs_message_create(void) GtkWidget *chkbtn_display_img; GtkWidget *chkbtn_resize_image; + GtkWidget *chkbtn_attach_desc; + vbox1 = gtk_vbox_new (FALSE, VSPACING); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); @@ -2468,6 +2476,10 @@ static void prefs_message_create(void) PACK_CHECK_BUTTON(vbox3, chkbtn_resize_image, _("Resize attached images")); + PACK_CHECK_BUTTON(vbox3, chkbtn_attach_desc, + _("Show attachment descriptions (rather than names)")); + + message.chkbtn_enablecol = chkbtn_enablecol; message.button_edit_col = button_edit_col; message.chkbtn_mbalnum = chkbtn_mbalnum; @@ -2483,6 +2495,8 @@ static void prefs_message_create(void) message.chkbtn_display_img = chkbtn_display_img; message.chkbtn_resize_image = chkbtn_resize_image; + + message.chkbtn_attach_desc = chkbtn_attach_desc; } #if USE_GPGME diff --git a/src/prefs_common.h b/src/prefs_common.h index 0eadffe16..0622f127d 100644 --- a/src/prefs_common.h +++ b/src/prefs_common.h @@ -218,6 +218,8 @@ struct _PrefsCommon gboolean show_other_header; GSList *disphdr_list; + gboolean attach_desc; + /* MIME viewer */ gchar *mime_image_viewer; gchar *mime_audio_player; diff --git a/src/procmime.c b/src/procmime.c index 97585cc3c..e7945a744 100644 --- a/src/procmime.c +++ b/src/procmime.c @@ -482,12 +482,10 @@ void procmime_scan_content_description(MimeInfo *mimeinfo, blen = strlen(buf) + 1; Xalloca(tmp, blen, return); conv_unmime_header(tmp, blen, buf, NULL); - g_free(mimeinfo->name); - mimeinfo->name = NULL; /*pgp signatures should NOT have a name */ if (mimeinfo->content_type && strcasecmp(mimeinfo->content_type, "application/pgp-signature")) - mimeinfo->name = g_strdup(tmp); + mimeinfo->description = g_strdup(tmp); } void procmime_scan_subject(MimeInfo *mimeinfo, diff --git a/src/procmime.h b/src/procmime.h index ededf13fe..132885a4d 100644 --- a/src/procmime.h +++ b/src/procmime.h @@ -97,6 +97,7 @@ struct _MimeInfo gchar *content_disposition; gchar *filename; + gchar *description; glong fpos; guint size; -- 2.25.1