r4310 - in trunk/src/target/OM-2007.2/applications/openmoko-dialer2: . src/common

erin_yueh at sita.openmoko.org erin_yueh at sita.openmoko.org
Fri Apr 4 18:55:40 CEST 2008


Author: erin_yueh
Date: 2008-04-04 18:55:32 +0200 (Fri, 04 Apr 2008)
New Revision: 4310

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-contacts.c
Log:
openmoko-dialer2: cannot display Contact name in Call history (Erin Yueh)


Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2008-04-04 12:12:50 UTC (rev 4309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2008-04-04 16:55:32 UTC (rev 4310)
@@ -1,3 +1,9 @@
+2008-04-05  Erin Yueh  <erin_yueh at openmoko.com>
+
+	* src/common/moko-contacts.c: (moko_contacts_add_contact), (moko_contacts_init)
+
+	bug#1305: cannot display Contact name in Call history
+
 2008-03-31  Thomas Wood  <thomas at openedhand.com>
 
 	* src/dialer/dialer-main.c: (main):

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-contacts.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-contacts.c	2008-04-04 12:12:50 UTC (rev 4309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-contacts.c	2008-04-04 16:55:32 UTC (rev 4310)
@@ -48,7 +48,7 @@
   GList      *contacts;
   GList      *entries;
   GHashTable *prefixes;
-
+  GHashTable *uids;
   Digit *start;
 };
 
@@ -251,25 +251,32 @@
 {
   MokoContactsPrivate *priv;
   MokoContact *m_contact = NULL;
-  const gchar *name;
+  const gchar *name, *uid;
   GList *attributes, *params, *numbers;
 
   g_return_if_fail (MOKO_IS_CONTACTS (contacts));
   g_return_if_fail (E_IS_CONTACT (e_contact));
   priv = contacts->priv;
 
+  uid = e_contact_get_const (e_contact, E_CONTACT_UID);
+  if (g_hash_table_lookup (priv->uids, uid))
+	  return;
+  
   name = e_contact_get_const (e_contact, E_CONTACT_FULL_NAME);
   if (!name || (g_utf8_strlen (name, -1) <= 0))
     name = "Unknown";
-    
+  
   /* Create the contact & append to the list */
   m_contact = g_new0 (MokoContact, 1);
   m_contact->name = g_strdup (name);
-  m_contact->uid = e_contact_get (e_contact, E_CONTACT_UID);
+  m_contact->uid = g_strdup (uid);
   m_contact->photo = NULL;
 
   priv->contacts = g_list_append (priv->contacts, m_contact);
-   
+  g_hash_table_insert (priv->uids,
+                       g_strdup (uid), 
+                       m_contact);
+
   /* Now go through the numbers,creating MokoNumber for them */
   for (attributes = e_vcard_get_attributes (E_VCARD(e_contact)); attributes; attributes = attributes->next)
   {
@@ -367,6 +374,7 @@
   priv = MOKO_CONTACTS (contacts)->priv;
 
   g_hash_table_destroy (priv->prefixes);
+  g_hash_table_destroy (priv->uids);
 
   for (l = priv->contacts; l != NULL; l = l->next)
   {
@@ -420,6 +428,7 @@
   EBook *book;
   EBookView *view;
   EBookQuery *query;
+  GList *contact, *c;
 
   priv = contacts->priv = MOKO_CONTACTS_GET_PRIVATE (contacts);
 
@@ -428,7 +437,8 @@
   priv->start = NULL;
   priv->prefixes = g_hash_table_new ((GHashFunc)g_str_hash,
                                      (GEqualFunc)g_str_equal);
-  
+  priv->uids = g_hash_table_new ((GHashFunc)g_str_hash,
+                                     (GEqualFunc)g_str_equal);
   query = e_book_query_any_field_contains ("");
 
   /* Open the system book and check that it is valid */
@@ -438,10 +448,23 @@
     g_warning ("Failed to create system book\n");
     return;
   }
+  
   if (!e_book_open (book, FALSE, NULL))
   {
     g_warning ("Failed to open system book\n");
     return;
+  }  
+  
+  if (!e_book_get_contacts (book, query, &contact, NULL)) 	 
+  { 	 
+     g_warning ("Failed to get contacts from system book\n"); 	 
+     return; 	 
+  } 	 
+  	 
+  /* Go through the contacts, creating the contact structs, and entry structs*/ 	 
+  for (c = contact; c != NULL; c = c->next) 	 
+  { 	 
+     moko_contacts_add_contact (contacts, E_CONTACT (c->data)); 	 
   }
 
   /* Connect to the ebookviews signals */





More information about the commitlog mailing list