diff --git a/sflphone-client-gnome/src/callable_obj.c b/sflphone-client-gnome/src/callable_obj.c index 67fde62f7a8a583dd7e1b48d6eac0dbb09af739a..19fe2998816fcd08d9d46cc701e54e5a599f6158 100644 --- a/sflphone-client-gnome/src/callable_obj.c +++ b/sflphone-client-gnome/src/callable_obj.c @@ -155,22 +155,24 @@ void *threaded_clock_incrementer(void *pc) { if( duration / 60 == 0 ) { if( duration < 10 ) - res = g_markup_printf_escaped("00:0%i", duration); + call->_timestr = g_markup_printf_escaped("00:0%i", duration); else - res = g_markup_printf_escaped("00:%i", duration); + call->_timestr = g_markup_printf_escaped("00:%i", duration); } else { if( duration%60 < 10 ) - res = g_markup_printf_escaped("%i:0%i" , duration/60 , duration%60); + call->_timestr = g_markup_printf_escaped("%i:0%i" , duration/60 , duration%60); else - res = g_markup_printf_escaped("%i:%i" , duration/60 , duration%60); + call->_timestr = g_markup_printf_escaped("%i:%i" , duration/60 , duration%60); } // return g_markup_printf_escaped("<small>Duration:</small> %s", res); - DEBUG("%s", res); + // call->_timestr = res; + + DEBUG("%s", call->_timestr); - calltree_update_clock(call); + calltree_update_clock(); sleep(1); } diff --git a/sflphone-client-gnome/src/callable_obj.h b/sflphone-client-gnome/src/callable_obj.h index 414245854f06956d82d24a607561f8742e4a4904..581651b05dc1ea807e5eb840a53b34c068e8260c 100644 --- a/sflphone-client-gnome/src/callable_obj.h +++ b/sflphone-client-gnome/src/callable_obj.h @@ -112,6 +112,7 @@ typedef struct { time_t _time_start; // The timestamp the call was initiating time_t _time_current; // Clock increment to display call's elapsed time time_t _time_stop; // The timestamp the call was over + gchar *_timestr; // The timestamp as a string format for history_state_t _history_state; // The history state if necessary srtp_state_t _srtp_state; // The state of security on the call gchar* _srtp_cipher; // Cipher used for the srtp session @@ -154,7 +155,7 @@ typedef struct { // thread id to increment clock pthread_t tid; - int clockStarted; + int clockStarted; } callable_obj_t; @@ -194,9 +195,6 @@ gchar* call_get_peer_name (const gchar*); */ gchar* call_get_peer_number (const gchar*); - - - void attach_thumbnail (callable_obj_t *, GdkPixbuf *); diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index 051f147c5627e4ccebc7da84405e4c62f93b0106..87118f31f981db7d609a1c7540d0f22b197bb951 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -1406,12 +1406,14 @@ void calltree_display (calltab_t *tab) { } -void -calltree_update_clock(callable_obj_t *c) { +void calltree_update_clock() { DEBUG("UPDATE CLOCK"); // TODO this make the whole thing crash... // calltree_update_call(current_calls, c, NULL); + + if(selected_call) + statusbar_update_clock(selected_call->_timestr); } diff --git a/sflphone-client-gnome/src/contacts/calltree.h b/sflphone-client-gnome/src/contacts/calltree.h index 899ea71e428e00684ca389e4645a65282f419b19..b6a9eca3afcb974203e1b7e20f20936a06742ede 100644 --- a/sflphone-client-gnome/src/contacts/calltree.h +++ b/sflphone-client-gnome/src/contacts/calltree.h @@ -111,7 +111,10 @@ calltree_display (calltab_t *tab); void row_activated(GtkTreeView *, GtkTreePath *, GtkTreeViewColumn *, void *); +/** + * Update elapced time based on selected calltree's call + */ void -calltree_update_clock(callable_obj_t *c); +calltree_update_clock(); #endif diff --git a/sflphone-client-gnome/src/mainwindow.c b/sflphone-client-gnome/src/mainwindow.c index cf3ca817572c8c3fb16dfeaa2846c31a24459755..7376858e52f1104072f50ac57f0a69fa94768dbf 100644 --- a/sflphone-client-gnome/src/mainwindow.c +++ b/sflphone-client-gnome/src/mainwindow.c @@ -59,6 +59,9 @@ GtkWidget * statusBar = NULL; GtkWidget * filterEntry = NULL; PidginScrollBook *embedded_error_notebook; +gchar *status_current_message = NULL; +pthread_mutex_t statusbar_message_mutex; + /** * Handle main window resizing */ @@ -91,6 +94,8 @@ on_delete (GtkWidget * widget UNUSED, gpointer data UNUSED) else { sflphone_quit (); } + + pthread_mutex_destroy(&statusbar_message_mutex); return TRUE; } @@ -292,6 +297,8 @@ create_main_window () /* don't show waiting layer */ gtk_widget_hide (waitingLayer); + pthread_mutex_init(&statusbar_message_mutex, NULL); + // Configuration wizard if (account_list_get_size () == 1) { @@ -407,20 +414,51 @@ main_window_volume_controls (gboolean state) void statusbar_push_message (const gchar * message, guint id) { - gtk_statusbar_push (GTK_STATUSBAR(statusBar), id, message); + // DEBUG("Message: %s", message); + + // if(id == __MSG_ACCOUNT_DEFAULT) + pthread_mutex_lock(&statusbar_message_mutex); + + g_free(status_current_message); + status_current_message = g_strdup(message); + + gtk_statusbar_push (GTK_STATUSBAR(statusBar), id, message); + + pthread_mutex_unlock(&statusbar_message_mutex); } void statusbar_pop_message (guint id) { - gtk_statusbar_pop (GTK_STATUSBAR(statusBar), id); + gtk_statusbar_pop (GTK_STATUSBAR(statusBar), id); } - static void +void +statusbar_update_clock(gchar *msg) +{ + gchar *message; + + pthread_mutex_lock(&statusbar_message_mutex); + message = g_strdup(status_current_message); + pthread_mutex_unlock(&statusbar_message_mutex); + + DEBUG("------------------------------ MESSAGE %s", message); + + if(message) { + DEBUG("STATUS CURRENT MESSAGE %s", status_current_message); + + statusbar_pop_message(__MSG_ACCOUNT_DEFAULT); + statusbar_push_message(message, __MSG_ACCOUNT_DEFAULT); + } + + g_free(message); +} + +static void add_error_dialog (GtkWidget *dialog, callable_obj_t * call) { - gtk_container_add (GTK_CONTAINER(embedded_error_notebook), dialog); - call_add_error (call, dialog); + gtk_container_add (GTK_CONTAINER(embedded_error_notebook), dialog); + call_add_error (call, dialog); } static void diff --git a/sflphone-client-gnome/src/mainwindow.h b/sflphone-client-gnome/src/mainwindow.h index db7007cd3c315733710fa8c4ab9c2ebf00ee8887..17a4ffdfae8683238051ee9c8252a5d6666a090d 100644 --- a/sflphone-client-gnome/src/mainwindow.h +++ b/sflphone-client-gnome/src/mainwindow.h @@ -105,6 +105,13 @@ void statusbar_push_message( const gchar* message , guint id ); */ void statusbar_pop_message( guint id ); +/** + * Update selected call's clock in statusbar + * @param id The identifier of the message + */ +void statusbar_update_clock( gchar *time); + + //static gboolean //on_key_released (GtkWidget *widget, GdkEventKey *event, // gpointer user_data);