r2171 - trunk/src/target/OM-2007/applications/openmoko-dialer/src

njp at sita.openmoko.org njp at sita.openmoko.org
Wed Jun 6 11:39:53 CEST 2007


Author: njp
Date: 2007-06-06 11:39:52 +0200 (Wed, 06 Jun 2007)
New Revision: 2171

Modified:
   trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-window-history.c
   trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-window-outgoing.c
Log:
Fix call ordering in history; Clean up journal code for outgoing calls

Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-window-history.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-window-history.c	2007-06-06 08:00:36 UTC (rev 2170)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-window-history.c	2007-06-06 09:39:52 UTC (rev 2171)
@@ -726,7 +726,23 @@
   return TRUE;
 }
 
+/* Sort two entries by date */
+static gint
+sort_by_date (MokoJournalEntry *a, MokoJournalEntry *b)
+{
+  const MokoTime *at, *bt;
+  time_t ta, tb;
+  
+  at = moko_journal_entry_get_dtstart (a);
+  bt = moko_journal_entry_get_dtstart (b);
+  
+  ta = moko_time_as_timet (at);
+  tb = moko_time_as_timet (bt);
+  
+  return (gint)difftime (ta, tb);
+}
 
+
 /**
  * @brief find the treeview in the window, fill-in the data and show it on the screen.
  *
@@ -749,6 +765,7 @@
   GtkWidget *contactview = NULL;
   int i = 0, j =0, n_entries;
   MokoJournalEntry *j_entry;
+  GList *entries = NULL, *e;
   //DBG_ENTER();
 
   //DBG_TRACE();
@@ -833,15 +850,20 @@
   }
   
   i = j = 0;
-  for (i = 0; i < n_entries && j < HISTORY_MAX_ENTRIES; i++)
+  for (i = 0; i < n_entries; i++)
   {
     moko_journal_get_entry_at (p_dialer_data->journal, i, &j_entry);
     
     /* We're not interested in anything other than voice entrys */
     if (moko_journal_entry_get_type (j_entry) != VOICE_JOURNAL_ENTRY)
-    {
       continue;
-    }
+
+    entries = g_list_insert_sorted (entries, 
+                                    (gpointer)j_entry,
+                                    (GCompareFunc)sort_by_date);
+  }
+  for (e = entries; e != NULL && j < HISTORY_MAX_ENTRIES; e = e->next) 
+  {
     if (history_add_entry (list_store, j_entry))
       j++;
   }

Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-window-outgoing.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-window-outgoing.c	2007-06-06 08:00:36 UTC (rev 2170)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-window-outgoing.c	2007-06-06 09:39:52 UTC (rev 2171)
@@ -153,10 +153,10 @@
   moko_journal_entry_set_direction (entry, DIRECTION_OUT);
   moko_journal_entry_get_voice_info (entry, &info);
   moko_journal_entry_set_dtstart (entry, moko_time_new_today ());
+  moko_journal_voice_info_set_distant_number (info, number);
   moko_journal_add_entry (data->journal, entry);
-  moko_journal_voice_info_set_distant_number (info, number);
-  /* FIXME: We should be able to associate a number with a number, and add that
-            info to the entry */
+  /* FIXME: We should be able to associate a number with a contact uid, and 
+            add that info to the entry */
 
   /* connect our handler to track call progress */
   progress_handler = g_signal_connect (data->connection, "call-progress", 





More information about the commitlog mailing list