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

njp at sita.openmoko.org njp at sita.openmoko.org
Tue Jun 5 17:15:01 CEST 2007


Author: njp
Date: 2007-06-05 17:15:00 +0200 (Tue, 05 Jun 2007)
New Revision: 2167

Modified:
   trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-window-history.c
Log:
'Delete call' code cleanup; Added a variable, to limit number of entries that are shown in the history view

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-05 14:56:52 UTC (rev 2166)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-window-history.c	2007-06-05 15:15:00 UTC (rev 2167)
@@ -41,6 +41,8 @@
   INCOMING
 } CallFilter;
 
+#define HISTORY_MAX_ENTRIES 25
+
 #define HISTORY_CALL_INCOMING_ICON "moko-history-call-in"
 #define HISTORY_CALL_OUTGOING_ICON "moko-history-call-out"
 #define HISTORY_CALL_MISSED_ICON "moko-history-call-missed"
@@ -219,7 +221,6 @@
   GtkTreeSelection *selection;
   GtkTreeView *treeview;
   GtkTreePath *path;
-  MokoJournalEntry *entry = NULL;
   const gchar *uid;
   gint result = 0;
   
@@ -232,16 +233,10 @@
     return;
   }
   
-  gtk_tree_model_get (model, &iter, HISTORY_ENTRY_POINTER, &entry, -1);
+  gtk_tree_model_get (model, &iter, HISTORY_ENTRY_POINTER, &uid, -1);
   
-  if (entry == NULL)
+  if (uid == NULL)
         return;
-  
-  if (!(uid = moko_journal_entry_get_uid (entry))) 
-  {
-    g_print ("Unable to get entry\n");
-    return;
-  }
   /* We need to show a dialog to make sure this is what the user wants */
   dialog = moko_message_dialog_new ();
   
@@ -720,7 +715,7 @@
       HISTORY_ICON_NAME_COLUMN, icon,
       HISTORY_DISPLAY_TEXT_COLUMN, display_text,
       HISTORY_CALL_TYPE_COLUMN, type,
-      HISTORY_ENTRY_POINTER, (gpointer)j_entry,
+      HISTORY_ENTRY_POINTER, uid,
       -1);
   return TRUE;
 }
@@ -781,7 +776,7 @@
                                       GDK_TYPE_PIXBUF, 
                                       G_TYPE_STRING,
                                       G_TYPE_INT,
-                                      G_TYPE_POINTER);
+                                      G_TYPE_STRING);
                                       
   p_dialer_data->g_list_store = list_store;
   
@@ -832,17 +827,17 @@
   }
   
   i = j = 0;
-  while (moko_journal_get_entry_at (p_dialer_data->journal, i, &j_entry))
+  for (i = 0; i < n_entries && j < HISTORY_MAX_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)
     {
-      i++;
       continue;
     }
     if (history_add_entry (list_store, j_entry))
       j++;
-    i++;
   }
   
   return 1;





More information about the commitlog mailing list