diff --git a/sflphone-client-gnome/src/callable_obj.c b/sflphone-client-gnome/src/callable_obj.c index 66766a485ccb0833a17cff9ab0a969b844abf65c..5958bb29e919dd8d2320ed20353219d8bc880350 100644 --- a/sflphone-client-gnome/src/callable_obj.c +++ b/sflphone-client-gnome/src/callable_obj.c @@ -490,39 +490,36 @@ gchar* get_history_id_from_state (history_state_t state) } } -gchar* get_formatted_start_timestamp (callable_obj_t *obj) +// gchar* get_formatted_start_timestamp (callable_obj_t *obj) +gchar *get_formatted_start_timestamp (time_t time_start) { struct tm* ptr; time_t lt, now; unsigned char str[100]; - if (obj) { - // Fetch the current timestamp - (void) time (&now); - lt = obj->_time_start; + // Fetch the current timestamp + (void) time (&now); + lt = time_start; - ptr = localtime (<); + ptr = localtime (<); - if (now - lt < UNIX_WEEK) { - if (now-lt < UNIX_DAY) { - strftime ( (char *) str, 100, N_ ("today at %R"), (const struct tm *) ptr); + if (now - lt < UNIX_WEEK) { + if (now-lt < UNIX_DAY) { + strftime ( (char *) str, 100, N_ ("today at %R"), (const struct tm *) ptr); + } else { + if (now - lt < UNIX_TWO_DAYS) { + strftime ( (char *) str, 100, N_ ("yesterday at %R"), (const struct tm *) ptr); } else { - if (now - lt < UNIX_TWO_DAYS) { - strftime ( (char *) str, 100, N_ ("yesterday at %R"), (const struct tm *) ptr); - } else { - strftime ( (char *) str, 100, N_ ("%A at %R"), (const struct tm *) ptr); - } + strftime ( (char *) str, 100, N_ ("%A at %R"), (const struct tm *) ptr); } - } else { - strftime ( (char *) str, 100, N_ ("%x at %R"), (const struct tm *) ptr); } - - // result function of the current locale - return g_markup_printf_escaped ("\n%s\n" , str); + } else { + strftime ( (char *) str, 100, N_ ("%x at %R"), (const struct tm *) ptr); } - return ""; + // result function of the current locale + return g_markup_printf_escaped ("\n%s\n" , str); } void set_timestamp (time_t *timestamp) diff --git a/sflphone-client-gnome/src/callable_obj.h b/sflphone-client-gnome/src/callable_obj.h index fd43e7abf2e70846b2384cb445d7a27fed7f490d..f64e40015459a9fdc67acea1b8347e454e4c9a8b 100644 --- a/sflphone-client-gnome/src/callable_obj.h +++ b/sflphone-client-gnome/src/callable_obj.h @@ -227,7 +227,7 @@ gchar* serialize_history_entry (callable_obj_t *entry); gchar* get_history_id_from_state (history_state_t state); -gchar* get_formatted_start_timestamp (callable_obj_t *obj); +gchar* get_formatted_start_timestamp (time_t); void set_timestamp (time_t*); diff --git a/sflphone-client-gnome/src/conference_obj.h b/sflphone-client-gnome/src/conference_obj.h index 04b15ac34a41c5aa510aa88d82f9cd23025e6631..5a9f87988c706dd4a01b4140104ff3ba45548900 100644 --- a/sflphone-client-gnome/src/conference_obj.h +++ b/sflphone-client-gnome/src/conference_obj.h @@ -63,7 +63,9 @@ typedef struct { gboolean _conf_srtp_enabled; // security required for this conference GSList *participant_list; // participant list for this GtkWidget *_im_widget; // associated instant messaging widget - + time_t _time_start; + time_t _time_stop; + time_t _time_current; } conference_obj_t; void create_new_conference (conference_state_t, const gchar*, conference_obj_t **); diff --git a/sflphone-client-gnome/src/contacts/calllist.c b/sflphone-client-gnome/src/contacts/calllist.c index e12170ad9ed17a195f6c840524b9c5b3775098a4..765ce2b874d0c7552af28040c6c3cedb10a1bf86 100644 --- a/sflphone-client-gnome/src/contacts/calllist.c +++ b/sflphone-client-gnome/src/contacts/calllist.c @@ -104,8 +104,9 @@ calllist_add (calltab_t* tab, callable_obj_t * c) { if (tab == history) { calllist_add_history_entry (c); - } else + } else { g_queue_push_tail (tab->callQueue, (gpointer *) c); + } } // TODO : sflphoneGTK : try to do this more generic diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index ecfd9bf02f205cb4cecfb41c448a4c06793ef616..c2d1296708c244379cc5da369f47c7ef7ff5dd30 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -73,6 +73,7 @@ callable_obj_t *selected_call; conference_obj_t *dragged_conf; conference_obj_t *selected_conf; +static void calltree_add_history_conference(conference_obj_t *); static void drag_begin_cb (GtkWidget *widget, GdkDragContext *dc, gpointer data); static void drag_end_cb (GtkWidget * mblist, GdkDragContext * context, gpointer data); @@ -868,7 +869,7 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) calltree_display_call_info (c, DISPLAY_TYPE_HISTORY, NULL, &description); - date = get_formatted_start_timestamp (c); + date = get_formatted_start_timestamp (c->_time_start); duration = get_call_duration (c); duration = g_strconcat (date , duration , NULL); description = g_strconcat (description , duration, NULL); @@ -1010,7 +1011,7 @@ void calltree_add_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) void calltree_add_history_entry (callable_obj_t * c) { - DEBUG ("calltree_add_history_entry %s", c->_callID); + DEBUG ("CallTree: Calltree add history entry %s", c->_callID); if (!eel_gconf_get_integer (HISTORY_ENABLED)) return; @@ -1040,7 +1041,7 @@ void calltree_add_history_entry (callable_obj_t * c) WARN ("History - Should not happen!"); } - date = get_formatted_start_timestamp (c); + date = get_formatted_start_timestamp (c->_time_start); duration = get_call_duration (c); duration = g_strconcat (date , duration , NULL); description = g_strconcat (description , duration, NULL); @@ -1065,8 +1066,9 @@ void calltree_add_history_entry (callable_obj_t * c) 3, c, // Pointer -1); - if (pixbuf != NULL) + if (pixbuf != NULL) { g_object_unref (G_OBJECT (pixbuf)); + } if (pixbuf_security != NULL) { g_object_unref (G_OBJECT (pixbuf_security)); @@ -1101,13 +1103,16 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) return; } + if(tab == history) { + calltree_add_history_conference(conf); + return; + } description = g_markup_printf_escaped ("<b>%s</b>", ""); gtk_tree_store_append (tab->store, &iter, NULL); if (tab == current_calls) { - switch (conf->_state) { case CONFERENCE_STATE_ACTIVE_ATACHED: pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/usersAttached.svg", NULL); @@ -1127,7 +1132,9 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) WARN ("Update conference add - Should not happen!"); } } - + else if(tab == history) { + pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersAttached.svg", NULL); + } //Resize it if (pixbuf) { @@ -1138,6 +1145,8 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) DEBUG ("Error no pixbuff for conference from %s", ICONS_DIR); } + if(tab == current_calls) { + // Used to determine if at least one participant use a security feature // If true (at least on call use a security feature) we need to display security icons conf->_conf_srtp_enabled = FALSE; @@ -1214,6 +1223,7 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) pixbuf_security = gdk_pixbuf_new_from_file (ICONS_DIR "/lock_off.svg", NULL); } } + } DEBUG ("Calltree: Add conference to tree store"); @@ -1224,8 +1234,13 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) 3, conf, // Pointer -1); - if (pixbuf != NULL) + if (pixbuf != NULL) { g_object_unref (G_OBJECT (pixbuf)); + } + + if(tab == history) { + return; + } // participant = conf->participant; // participant = dbus_get_participant_list(conf->_confID); @@ -1266,7 +1281,6 @@ void calltree_add_conference (calltab_t* tab, conference_obj_t* conf) } - void calltree_update_conference (calltab_t* tab, const conference_obj_t* conf) { DEBUG ("CallTree: Update conference %s\n", conf->_confID); @@ -1341,6 +1355,30 @@ void calltree_remove_conference (calltab_t* tab, const conference_obj_t* conf, G } +void calltree_add_history_conference(conference_obj_t *conf) { + GdkPixbuf *pixbuf = NULL; + gchar *description = ""; + GtkTreeIter iter; + + DEBUG("------------------------------ ADD CONFERENCE TO HISTORY"); + + gtk_tree_store_prepend(history->store, &iter, NULL); + + pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/", NULL); + + if(pixbuf) { + if(gdk_pixbuf_get_width(pixbuf) > 32 || gdk_pixbuf_get_height(pixbuf) > 32) { + pixbuf = gdk_pixbuf_scale_simple(pixbuf, 32, 32, GDK_INTERP_BILINEAR); + } + } + + gtk_tree_store_set(history->store, &iter, 0, pixbuf, 1, description, 2, NULL, 3, conf, -1); + + if(pixbuf != NULL) { + g_object_unref(G_OBJECT(pixbuf)); + } +} + void calltree_display (calltab_t *tab) { diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index 91ca2962eb5374af94eb16711794947335d80ee6..d6c1294e0caafbbf530db474b394c4c043b94170 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -346,6 +346,7 @@ conference_created_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo conferencelist_add (new_conf); calltree_add_conference (current_calls, new_conf); + calltree_add_conference (history, new_conf); } static void