Commit 4a1828c1 authored by Emmanuel Milou's avatar Emmanuel Milou

Attach evolution contact thumbnail in the contact list

parent aa316079
......@@ -238,3 +238,7 @@ void create_new_call (gchar *to, gchar *from, call_state_t state, gchar *account
*new_call = call;
}
void attach_thumbnail (call_t *call, GdkPixbuf *pixbuf) {
call->contact_thumbnail = pixbuf;
}
......@@ -106,7 +106,8 @@ typedef struct {
call_state_t state;
/** The history state if necessary */
history_state_t history_state;
contact_type_t contact_type;
GdkPixbuf *contact_thumbnail;
time_t _start;
time_t _stop;
......@@ -205,4 +206,7 @@ void call_list_clean_history();
void call_list_remove_from_history( call_t* c);
void create_new_call (gchar *to, gchar *from, call_state_t state, gchar *accountID, call_t **new_call);
void attach_thumbnail (call_t *call, GdkPixbuf *pixbuf);
#endif
......@@ -231,10 +231,21 @@ handler_async_search (GList *hits, gpointer user_data) {
GList *i;
GdkPixbuf *photo = NULL;
AddressBook_Config *addressbook_config;
call_t *j;
// Load the parameters
addressbook_load_parameters (&addressbook_config);
// 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);
for (i = hits; i != NULL; i = i->next)
{
Hit *entry;
......@@ -273,7 +284,6 @@ handler_async_search (GList *hits, gpointer user_data) {
show_contacts_tab(GtkToggleToolButton *toggle_tool_button UNUSED,
gpointer user_data UNUSED)
{
call_t *j;
gchar* msg;
// temporary display in status bar
......@@ -281,16 +291,6 @@ show_contacts_tab(GtkToggleToolButton *toggle_tool_button UNUSED,
statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
g_free(msg);
// 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 synchronous search
//results = search_sync (gtk_entry_get_text(GTK_ENTRY(filter_entry)), 50);
......@@ -302,12 +302,35 @@ void create_new_entry_in_contactlist (gchar *contact_name, gchar *contact_phone,
gchar *from;
call_t *new_call;
GdkPixbuf *pixbuf;
/* Check if the information is valid */
if (g_strcasecmp (contact_phone, EMPTY_ENTRY) != 0){
from = g_strconcat("\"" , contact_name, "\"<", contact_phone, ">", NULL);
create_new_call (from, from, CALL_STATE_DIALING, "", &new_call);
new_call->contact_type = type;
// Attach a pixbuf to a contact
if (photo) {
attach_thumbnail (new_call, photo);
}
else {
switch (type) {
case CONTACT_PHONE_BUSINESS:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/face-monkey.svg", NULL);
break;
case CONTACT_PHONE_HOME:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/home.svg", NULL);
break;
case CONTACT_PHONE_MOBILE:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/users.svg", NULL);
break;
default:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/contact_default.svg", NULL);
break;
}
attach_thumbnail (new_call, pixbuf);
}
call_list_add (contacts, new_call);
update_call_tree_add(contacts, new_call);
}
......@@ -960,21 +983,7 @@ update_call_tree_add (calltab_t* tab, call_t * c)
}
else if (tab == contacts) {
switch (c->contact_type)
{
case CONTACT_PHONE_HOME:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/home.svg", NULL);
break;
case CONTACT_PHONE_BUSINESS:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/face-monkey.svg", NULL);
break;
case CONTACT_PHONE_MOBILE:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/users.svg", NULL);
break;
default:
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/contact_default.svg", NULL);
break;
}
pixbuf = c->contact_thumbnail;
description = g_strconcat( description , NULL);
}
......
......@@ -39,7 +39,7 @@ typedef struct _Handler_And_Data {
} Handler_And_Data;
static GSList *books = NULL;
static int pixbuf_size = 16;
static int pixbuf_size = 32;
static EContactField search_fields[] = { E_CONTACT_FULL_NAME, E_CONTACT_PHONE_BUSINESS, E_CONTACT_NICKNAME, 0 };
static int n_search_fields = G_N_ELEMENTS (search_fields) - 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment