aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorSankarasivasubramanian Pasupathilingam <psankar@src.gnome.org>2008-09-30 15:59:12 +0800
committerSankarasivasubramanian Pasupathilingam <psankar@src.gnome.org>2008-09-30 15:59:12 +0800
commit4fd6e00afa491bd490f5c44f5abe6858b860e5ff (patch)
tree35e50a0856d4e4aad081a6e6d1a05e89a42417b7 /mail
parentdaed271924f589e8e500a74decf8a25276a283f4 (diff)
downloadgsoc2013-evolution-4fd6e00afa491bd490f5c44f5abe6858b860e5ff.tar.gz
gsoc2013-evolution-4fd6e00afa491bd490f5c44f5abe6858b860e5ff.tar.zst
gsoc2013-evolution-4fd6e00afa491bd490f5c44f5abe6858b860e5ff.zip
Added new column "Subject - Trimmed". Patch by hpj.
svn path=/trunk/; revision=36498
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog12
-rw-r--r--mail/message-list.c61
-rw-r--r--mail/message-list.etspec8
-rw-r--r--mail/message-list.h3
4 files changed, 81 insertions, 3 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 7284c865c8..0d818ce883 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,15 @@
+2008-09-30 Sankar P <psankar@novell.com>
+
+ ** Committed on behalf of Hans Petter Jansson <hpj@novell.com>
+
+ ** Fix for bug #554107
+
+ * message-list.c (get_trimmed_subject), (ml_tree_value_at):
+ * message-list.etspec:
+ * message-list.h:
+ Add "Subject - Trimmed" column which enables to read
+ mailing list mails in a better way.
+
2008-09-29 Gabor Kelemen <kelemeng@gnome.hu>
* mail-config.glade: Mark some forgotten strings for translation. Fixes bug #553067
diff --git a/mail/message-list.c b/mail/message-list.c
index ab3b1c0922..4819528945 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1269,6 +1269,61 @@ get_all_labels (CamelMessageInfo *msg_info, char **label_str, gboolean get_tags)
return count;
}
+static const char *
+get_trimmed_subject (CamelMessageInfo *info)
+{
+ const char *subject;
+ const char *mlist;
+ int mlist_len = 0;
+ gboolean found_mlist;
+
+ subject = camel_message_info_subject (info);
+ if (!subject || !*subject)
+ return subject;
+
+ mlist = camel_message_info_mlist (info);
+
+ if (mlist && *mlist) {
+ const char *mlist_end;
+
+ mlist_end = strchr (mlist, '@');
+ if (mlist_end)
+ mlist_len = mlist_end - mlist;
+ else
+ mlist_len = strlen (mlist);
+ }
+
+ do {
+ found_mlist = FALSE;
+
+ while (!g_ascii_strncasecmp ((char *) subject, "Re:", 3)) {
+ subject += 3;
+
+ /* jump over any spaces */
+ while (*subject && isspace ((int) *subject))
+ subject++;
+ }
+
+ if (mlist_len &&
+ *subject == '[' &&
+ !g_ascii_strncasecmp ((char *) subject + 1, mlist, mlist_len) &&
+ subject [1 + mlist_len] == ']') {
+ subject += 1 + mlist_len + 1; /* jump over "[mailing-list]" */
+ found_mlist = TRUE;
+
+ /* jump over any spaces */
+ while (*subject && isspace ((int) *subject))
+ subject++;
+ }
+ } while (found_mlist);
+
+ /* jump over any spaces */
+ while (*subject && isspace ((int) *subject))
+ subject++;
+
+ return subject;
+}
+
static void *
ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
{
@@ -1353,6 +1408,12 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
case COL_SUBJECT:
str = camel_message_info_subject (msg_info);
return (void *)(str ? str : "");
+ case COL_SUBJECT_TRIMMED:
+ /* FIXME: "Trimmed subject" is not normalized yet.
+ I do not find a way in evo gui to configure the normalized columns like from_norm
+ Hence this FIXME should remain until we have a COL_SUBJECT_TRIMMED_NORM. */
+ str = get_trimmed_subject (msg_info);
+ return (void *)(str ? str : "");
case COL_SUBJECT_NORM:
return (void *) get_normalised_string (message_list, msg_info, col);
case COL_SENT: {
diff --git a/mail/message-list.etspec b/mail/message-list.etspec
index 84fc12fafb..c8d438b90c 100644
--- a/mail/message-list.etspec
+++ b/mail/message-list.etspec
@@ -7,15 +7,15 @@
<ETableColumn model_col="3" _title="Attachment" pixbuf="attachment" expansion="0.0" minimum_width="18" resizable="false" cell="render_attachment" compare="integer" />
- <ETableColumn model_col="4" compare_col="19" _title="From" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare" search="string" priority="10"/>
+ <ETableColumn model_col="4" compare_col="20" _title="From" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare" search="string" priority="10"/>
- <ETableColumn model_col="5" compare_col="20" _title="Subject" expansion="1.6" minimum_width="32" resizable="true" cell="render_tree" compare="string" search="string"/>
+ <ETableColumn model_col="5" compare_col="21" _title="Subject" expansion="1.6" minimum_width="32" resizable="true" cell="render_tree" compare="string" search="string"/>
<ETableColumn model_col="6" _title="Date" expansion="0.4" minimum_width="32" resizable="true" cell="render_date" compare="integer"/>
<ETableColumn model_col="7" _title="Received" expansion="0.4" minimum_width="32" resizable="true" cell="render_date" compare="integer"/>
- <ETableColumn model_col="8" compare_col="21" _title="To" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare" search="string" priority="5"/>
+ <ETableColumn model_col="8" compare_col="22" _title="To" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare" search="string" priority="5"/>
<ETableColumn model_col="9" _title="Size" expansion="0.2" minimum_width="32" resizable="true" cell="render_size" compare="integer"/>
@@ -33,6 +33,8 @@
<ETableColumn model_col="17" _title="Sent Messages" expansion="1.0" minimum_width="32" resizable="true" cell="render_composite_to" compare="address_compare" search="string" priority="10" sortable="false"/>
<ETableColumn model_col="18" _title="Labels" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="string" search="string" priority="10"/>
+ <ETableColumn model_col="19" compare_col="21" _title="Subject - Trimmed" expansion="1.6" minimum_width="32" resizable="true" cell="render_tree" compare="string" search="string"/>
+
<ETableState>
<column source="0"/> <column source="3"/> <column source="1"/>
<column source="4"/> <column source="5" expansion="1.60"/> <column source="6" expansion="0.40"/>
diff --git a/mail/message-list.h b/mail/message-list.h
index b144708208..cc58e1e798 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -60,6 +60,9 @@ enum {
COL_MIXED_RECIPIENTS,
COL_LABELS,
+ /* subject with junk removed */
+ COL_SUBJECT_TRIMMED,
+
/* normalised strings */
COL_FROM_NORM,
COL_SUBJECT_NORM,