diff --git a/sflphone-gtk/src/calltree.c b/sflphone-gtk/src/calltree.c index b623a2b8c50970c4d595fd1eda8a4b51c1c8506c..19866bd797b2cf121593d4ca5e1894a3e2ffed04 100644 --- a/sflphone-gtk/src/calltree.c +++ b/sflphone-gtk/src/calltree.c @@ -42,6 +42,16 @@ GtkToolItem * mailboxButton; GtkToolItem * recButton; guint transfertButtonConnId; //The button toggled signal connection ID +void +free_call_t (call_t *c) +{ + g_free (c->callID); + g_free (c->accountID); + g_free (c->from); + g_free (c->to); + g_free (c); +} + /** * Show popup menu */ @@ -170,6 +180,12 @@ toggle_current_calls(GtkToggleToolButton *toggle_tool_button UNUSED, gpointer user_data UNUSED) { GtkTreeSelection *sel; + gchar* msg; + + // temporary display in status bar + msg = g_strdup("Current calls"); + statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT); + g_free(msg); active_calltree = current_calls; gtk_widget_hide(history->tree); @@ -187,6 +203,12 @@ toggle_history(GtkToggleToolButton *toggle_tool_button UNUSED, gpointer user_data UNUSED) { GtkTreeSelection *sel; + gchar* msg; + + // temporary display in status bar + msg = g_strdup("History"); + statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT); + g_free(msg); active_calltree = history; gtk_widget_hide(current_calls->tree); @@ -204,18 +226,31 @@ toggle_history(GtkToggleToolButton *toggle_tool_button UNUSED, toggle_contacts(GtkToggleToolButton *toggle_tool_button UNUSED, gpointer user_data UNUSED) { - GtkTreeSelection *sel; GList *results; GList *i; + call_t *j; + gchar* msg; + + // temporary display in status bar + msg = g_strdup("Contacts"); + statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT); + g_free(msg); + // debug printf("EDS : %s\n",gtk_entry_get_text(GTK_ENTRY(filter_entry))); - // Reset previous results - call_list_reset(contacts); + // freeing calls + while((j = (call_t *)g_queue_pop_tail (contacts->callQueue)) != NULL) + { + free_call_t(j); + } + + // reset previous results reset_call_tree(contacts); + call_list_reset(contacts); - // Do a synchronized search + // do a synchronized search results = search_sync (gtk_entry_get_text(GTK_ENTRY(filter_entry)), 50); if(results == NULL) @@ -240,7 +275,10 @@ toggle_contacts(GtkToggleToolButton *toggle_tool_button UNUSED, call_list_add (contacts, call); update_call_tree_add(contacts,call); } + free_hit(entry); } + g_list_free(results); + active_calltree = contacts; gtk_widget_hide(current_calls->tree); diff --git a/sflphone-gtk/src/calltree.h b/sflphone-gtk/src/calltree.h index d548eecaec84bae9bef06d12d8f97bfd93736083..7fc292b61cea33a8d44f4d5f1083b1811b113d61 100644 --- a/sflphone-gtk/src/calltree.h +++ b/sflphone-gtk/src/calltree.h @@ -37,6 +37,9 @@ GtkToolItem * contactButton; GtkWidget * filter_entry; calltab_t* active_calltree; + +void free_call_t (call_t *c); + /** * Create a new widget calltree * @return GtkWidget* A new widget diff --git a/sflphone-gtk/src/contactlist/eds.c b/sflphone-gtk/src/contactlist/eds.c index fbcd39eeff1bf8df58b7d7523739a1827f35905a..53cdab5a610ced70805db759ec7d0f292a998395 100644 --- a/sflphone-gtk/src/contactlist/eds.c +++ b/sflphone-gtk/src/contactlist/eds.c @@ -11,7 +11,7 @@ static EContactField search_fields[] = { E_CONTACT_FULL_NAME, E_CONTACT_PHONE_BU static int n_search_fields = G_N_ELEMENTS (search_fields) - 1; void -free_hit (Hit *h, gpointer unused) +free_hit (Hit *h) { g_free (h->name); g_free (h->phone); @@ -142,7 +142,7 @@ search_sync (const char *query, { // Temporary fix for empty phone numbers sprintf(ext, "%d", rand()%100 + 100); - hit->phone = g_strdup(ext); + hit->phone = g_strconcat("rand",ext,NULL); //hit->phone = ""; } diff --git a/sflphone-gtk/src/contactlist/eds.h b/sflphone-gtk/src/contactlist/eds.h index 859132ebde4503041ecafccf136076781224760a..c61459be56e4b165e7fff84d37d9585cdf5b83a8 100644 --- a/sflphone-gtk/src/contactlist/eds.h +++ b/sflphone-gtk/src/contactlist/eds.h @@ -12,7 +12,7 @@ typedef struct _Hit { gchar *phone; } Hit; -void free_hit (Hit *hit, gpointer unused); +void free_hit (Hit *hit); void init (void);