evolution r36498 - trunk/mail



Author: psankar
Date: Tue Sep 30 07:59:12 2008
New Revision: 36498
URL: http://svn.gnome.org/viewvc/evolution?rev=36498&view=rev

Log:
Added new column "Subject - Trimmed". Patch by hpj.

Modified:
   trunk/mail/ChangeLog
   trunk/mail/message-list.c
   trunk/mail/message-list.etspec
   trunk/mail/message-list.h

Modified: trunk/mail/message-list.c
==============================================================================
--- trunk/mail/message-list.c	(original)
+++ trunk/mail/message-list.c	Tue Sep 30 07:59:12 2008
@@ -1269,6 +1269,61 @@
 	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 @@
 	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: {

Modified: trunk/mail/message-list.etspec
==============================================================================
--- trunk/mail/message-list.etspec	(original)
+++ trunk/mail/message-list.etspec	Tue Sep 30 07:59:12 2008
@@ -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"/>

Modified: trunk/mail/message-list.h
==============================================================================
--- trunk/mail/message-list.h	(original)
+++ trunk/mail/message-list.h	Tue Sep 30 07:59:12 2008
@@ -60,6 +60,9 @@
 	COL_MIXED_RECIPIENTS,
 	COL_LABELS,
 
+	/* subject with junk removed */
+	COL_SUBJECT_TRIMMED,
+
 	/* normalised strings */
 	COL_FROM_NORM,
 	COL_SUBJECT_NORM,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]