raw dates/times in tny-msg-header-list + fix (patch)



Hi Philip,

Made a tiny patch to also get the raw dates (time_t) instead of their
string representations; this will allow frontends to do their their own
thing their. Their are many possibilities, so it's probably best left to
the frontend (eg. show the time for mails that came today, and the date
for older mails).

Sorting mails by date should be quite a bit faster also, if you sort by
time_t instead of the string repr (and sorting by string repr will in
many cases not give the right results, dep. on the particular repr of
course; the default now ok, but it's _(translatable), so...). 

Maybe you'd want to remove the string representation, and let renderers
deal with that. That might give some mem savings as well.

Oh, patch fixes also a tiny copy-paste bug.

Too many words for such a tiny patch...

Best wishes,
Dirk.  
 
--
Dirk-Jan C. Binnema, Project Manager
Nokia Multimedia, Open Source Software Operations

Index: trunk/libtinymailui-gtk/tny-msg-header-list-model.h
===================================================================
--- trunk/libtinymailui-gtk/tny-msg-header-list-model.h	(revision 482)
+++ trunk/libtinymailui-gtk/tny-msg-header-list-model.h	(working copy)
@@ -43,6 +43,8 @@
 	TNY_MSG_HEADER_LIST_MODEL_SUBJECT_COLUMN,
 	TNY_MSG_HEADER_LIST_MODEL_CC_COLUMN,
 	TNY_MSG_HEADER_LIST_MODEL_DATE_SENT_COLUMN,
+	TNY_MSG_HEADER_LIST_MODEL_DATE_RECEIVED_TIME_T_COLUMN,
+	TNY_MSG_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN,
 	TNY_MSG_HEADER_LIST_MODEL_DATE_RECEIVED_COLUMN,
 	TNY_MSG_HEADER_LIST_MODEL_INSTANCE_COLUMN,
 	TNY_MSG_HEADER_LIST_MODEL_FLAGS_COLUMN,
Index: trunk/libtinymailui-gtk/tny-msg-header-list-model.c
===================================================================
--- trunk/libtinymailui-gtk/tny-msg-header-list-model.c	(revision 482)
+++ trunk/libtinymailui-gtk/tny-msg-header-list-model.c	(working copy)
@@ -136,6 +136,8 @@
 		case TNY_MSG_HEADER_LIST_MODEL_INSTANCE_COLUMN:
 			retval = G_TYPE_POINTER;
 			break;
+		case TNY_MSG_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN:
+		case TNY_MSG_HEADER_LIST_MODEL_DATE_RECEIVED_TIME_T_COLUMN:
 		case TNY_MSG_HEADER_LIST_MODEL_FLAGS_COLUMN:
 			retval = G_TYPE_INT;
 			break;
@@ -274,8 +276,18 @@
 		case TNY_MSG_HEADER_LIST_MODEL_DATE_RECEIVED_COLUMN:
 			g_value_init (value, G_TYPE_STRING);
 			g_value_set_string (value, 
-				_get_readable_date (tny_msg_header_iface_get_date_sent (header)));
+				_get_readable_date (tny_msg_header_iface_get_date_received (header)));
 			break;
+		case TNY_MSG_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN:
+			g_value_init (value, G_TYPE_INT);
+			g_value_set_int (value, 
+					    tny_msg_header_iface_get_date_sent (header));
+			break;
+		case TNY_MSG_HEADER_LIST_MODEL_DATE_RECEIVED_TIME_T_COLUMN:
+			g_value_init (value, G_TYPE_INT);
+			g_value_set_int (value, 
+					 tny_msg_header_iface_get_date_received (header));
+			break;
 		case TNY_MSG_HEADER_LIST_MODEL_INSTANCE_COLUMN:
 			g_value_init (value, G_TYPE_POINTER);
 			g_value_set_pointer (value, header);


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