r3710 - in trunk/src/target/OM-2007.2/applications/openmoko-messages2: . src

chris at sita.openmoko.org chris at sita.openmoko.org
Thu Dec 20 17:28:20 CET 2007


Author: chris
Date: 2007-12-20 17:28:19 +0100 (Thu, 20 Dec 2007)
New Revision: 3710

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c
Log:
        * src/sms-notes.c: (sms_notes_data_func):
        Display contact names instead of phone numbers (fixes bug #1143)


Modified: trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog	2007-12-20 15:53:50 UTC (rev 3709)
+++ trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog	2007-12-20 16:28:19 UTC (rev 3710)
@@ -1,5 +1,10 @@
 2007-12-20  Chris Lord  <chris at openedhand.com>
 
+	* src/sms-notes.c: (sms_notes_data_func):
+	Display contact names instead of phone numbers (fixes bug #1143)
+
+2007-12-20  Chris Lord  <chris at openedhand.com>
+
 	* src/sms-notes.c: (note_changed_cb), (page_shown),
 	(sms_notes_data_func), (global_note_added_cb),
 	(notes_visible_func):

Modified: trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c	2007-12-20 15:53:50 UTC (rev 3709)
+++ trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c	2007-12-20 16:28:19 UTC (rev 3710)
@@ -22,6 +22,7 @@
 #endif
 
 #include "sms-notes.h"
+#include "sms-contacts.h"
 #include "sms-utils.h"
 #include <libjana/jana.h>
 #include <libjana-ecal/jana-ecal.h>
@@ -303,6 +304,7 @@
 	gchar *author, *recipient, *body, **categories;
 	JanaTime *created, *modified;
 	gboolean outgoing;
+	gint i;
 	
 	gtk_tree_model_get (model, iter,
 		JANA_GTK_NOTE_STORE_COL_AUTHOR, &author,
@@ -315,7 +317,6 @@
 
 	outgoing = FALSE;
 	if (categories) {
-		gint i;
 		for (i = 0; categories[i]; i++) {
 			if ((strcmp (categories[i], "Sent") == 0) ||
 			    (strcmp (categories[i], "Sending") == 0)) {
@@ -326,6 +327,30 @@
 		g_strfreev (categories);
 	}
 	
+	/* Replace numbers with contact names */
+	for (i = 0; i < 2; i++) {
+		const gchar *uid;
+		GtkTreeIter *iter;
+		gchar *number = i ? author : recipient;
+		gchar *name;
+		
+		if (!number) continue;
+		
+		uid = g_hash_table_lookup (data->numbers, number);
+		if (!uid) continue;
+		
+		iter = g_hash_table_lookup (data->contacts, uid);
+		if (!iter) continue;
+		
+		gtk_tree_model_get (data->contacts_store, iter,
+			COL_NAME, &name, -1);
+		if (name) {
+			g_free (number);
+			if (i) author = name;
+			else recipient = name;
+		}
+	}
+	
 	g_object_set (cell,
 		"author", author,
 		"recipient", recipient,





More information about the commitlog mailing list