Skip to content
Snippets Groups Projects
Commit 0f629424 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#3218] Fix two calls elapsed time

parent 67857fd8
Branches
Tags
No related merge requests found
......@@ -146,31 +146,33 @@ void *threaded_clock_incrementer(void *pc) {
start = call->_time_start;
current = call->_time_current;
if (current == start)
DEBUG("<small>Duration:</small> 0:00");
// return g_markup_printf_escaped("<small>Duration:</small> 0:00");
if (current == start) {
// DEBUG("<small>Duration:</small> 0:00");
call->_timestr = g_strdup_printf("00:00"); // g_markup_printf_escaped("00:00");
}
duration = (int) difftime(current, start);
if( duration / 60 == 0 )
{
if( duration < 10 )
call->_timestr = g_markup_printf_escaped("00:0%i", duration);
call->_timestr = g_strdup_printf("00:0%d", duration); // g_markup_printf_escaped("00:0%d", duration);
else
call->_timestr = g_markup_printf_escaped("00:%i", duration);
call->_timestr = g_strdup_printf("00:%d", duration); // g_markup_printf_escaped("00:%d", duration);
}
else
{
if( duration%60 < 10 )
call->_timestr = g_markup_printf_escaped("%i:0%i" , duration/60 , duration%60);
call->_timestr = g_strdup_printf("0%d:0%d", duration/60, duration%60); // g_markup_printf_escaped("0%d:0%d" , duration/60 , duration%60);
else
call->_timestr = g_markup_printf_escaped("%i:%i" , duration/60 , duration%60);
call->_timestr = g_strdup_printf("%d:%d", duration/60, duration%60); // g_markup_printf_escaped("%d:%d" , duration/60 , duration%60);
}
// return g_markup_printf_escaped("<small>Duration:</small> %s", res);
// call->_timestr = res;
DEBUG("%s", call->_timestr);
// DEBUG("PRINT THE CLOCK")
// DEBUG("CLOCK %s", call->_timestr);
calltree_update_clock();
......@@ -203,6 +205,7 @@ void create_new_call (callable_type_t type, call_state_t state, gchar* callID ,
set_timestamp (&(obj->_time_start));
set_timestamp (&(obj->_time_current));
set_timestamp (&(obj->_time_stop));
obj->_timestr = NULL;
if (g_strcasecmp (callID, "") == 0)
call_id = generate_call_id ();
......
......@@ -40,6 +40,7 @@
#include <addressbook-config.h>
#include <shortcuts-config.h>
#include <hooks-config.h>
#include <audioconf.h>
/**
* Local variables
......
......@@ -1407,13 +1407,22 @@ void calltree_display (calltab_t *tab) {
void calltree_update_clock() {
DEBUG("UPDATE CLOCK");
if(!selected_call)
return;
if(!(selected_call->_timestr))
return;
// DEBUG("UPDATE CLOCK %s", selected_call->_timestr);
// TODO this make the whole thing crash...
// calltree_update_call(current_calls, c, NULL);
if(selected_call)
statusbar_update_clock(selected_call->_timestr);
// set the time string to NULL once displayed
// g_free(selected_call->_timestr);
// selected_call->_timestr = NULL;
}
......
......@@ -417,7 +417,6 @@ statusbar_push_message (const gchar *left_hand_message, const gchar *right_hand_
// The actual message to be push in the statusbar
gchar *message_to_display;
pthread_mutex_lock(&statusbar_message_mutex);
g_free(status_current_message);
......@@ -426,8 +425,8 @@ statusbar_push_message (const gchar *left_hand_message, const gchar *right_hand_
// Format message according to right hand member
if(right_hand_message)
message_to_display = g_strdup_printf("%s %s"
, left_hand_message, right_hand_message);
message_to_display = g_strdup_printf("%s %s",
left_hand_message, right_hand_message);
else
message_to_display = g_strdup(left_hand_message);
......@@ -448,20 +447,22 @@ statusbar_pop_message (guint id)
void
statusbar_update_clock(gchar *msg)
{
gchar *message;
gchar *message = NULL;
pthread_mutex_lock(&statusbar_message_mutex);
message = g_strdup(status_current_message);
pthread_mutex_unlock(&statusbar_message_mutex);
if(message) {
// DEBUG("STATUS CURRENT MESSAGE %s", status_current_message);
DEBUG("CLOCK %s", msg);
statusbar_pop_message(__MSG_ACCOUNT_DEFAULT);
statusbar_push_message(message, msg, __MSG_ACCOUNT_DEFAULT);
}
g_free(message);
message = NULL;
}
static void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment