Commit 4a9d8b81 authored by Julien Bonjean's avatar Julien Bonjean

Merge branch 'master' into jbonjean

parents 4629fb04 7c9ac0c0
......@@ -137,7 +137,7 @@ status_bar_display_account ()
status_tray_icon_online(FALSE);
msg = g_markup_printf_escaped(_("No registered accounts"));
}
statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
statusbar_push_message( msg, NULL, __MSG_ACCOUNT_DEFAULT);
g_free(msg);
DEBUG("status_bar_display_account_end");
......@@ -189,6 +189,8 @@ sflphone_ringing(callable_obj_t * c )
void
sflphone_hung_up( callable_obj_t * c)
{
DEBUG("Actions: SFLphone hungup");
calllist_remove( current_calls, c->_callID);
calltree_remove_call(current_calls, c, NULL);
c->_state = CALL_STATE_DIALING;
......@@ -228,7 +230,7 @@ void sflphone_fill_account_list (void) {
if(!(*accountID))
DEBUG("hhhhhhhhhmmmmmmmmmmmm");
*/
for (accountID = array; *accountID; accountID++)
{
account_t * a = g_new0(account_t,1);
......@@ -321,10 +323,10 @@ void sflphone_fill_account_list (void) {
a->protocol_state_description = g_hash_table_lookup(details, REGISTRATION_STATE_DESCRIPTION);
}
// Set the current account message number
current_account_set_message_number (count);
sflphone_fill_codec_list ();
// Set the current account message number
current_account_set_message_number (count);
sflphone_fill_codec_list ();
}
gboolean sflphone_init() {
......@@ -605,7 +607,7 @@ sflphone_unset_transfert()
void
sflphone_display_transfer_status(const gchar* message)
{
statusbar_push_message( message , __MSG_ACCOUNT_DEFAULT);
statusbar_push_message( message , NULL, __MSG_ACCOUNT_DEFAULT);
}
void
......@@ -624,7 +626,7 @@ sflphone_incoming_call (callable_obj_t * c)
if(_is_direct_call(c)) {
msg = g_markup_printf_escaped (_("Direct SIP call"));
statusbar_pop_message(__MSG_ACCOUNT_DEFAULT);
statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
statusbar_push_message( msg , NULL, __MSG_ACCOUNT_DEFAULT);
g_free(msg);
}
}
......@@ -954,7 +956,7 @@ sflphone_place_call ( callable_obj_t * c )
if(_is_direct_call(c)) {
msg = g_markup_printf_escaped (_("Direct SIP call"));
statusbar_pop_message(__MSG_ACCOUNT_DEFAULT);
statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
statusbar_push_message( msg , NULL, __MSG_ACCOUNT_DEFAULT);
g_free(msg);
if(_place_direct_call(c) < 0) {
DEBUG("An error occured while placing direct call in %s at %d", __FILE__, __LINE__);
......
......@@ -139,38 +139,41 @@ void *threaded_clock_incrementer(void *pc) {
int duration;
time_t start, current;
gdk_threads_enter ();
set_timestamp(&(call->_time_current));
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) {
g_snprintf(call->_timestr, 20, "00:00");
}
duration = (int) difftime(current, start);
if( duration / 60 == 0 )
{
if( duration < 10 )
res = g_markup_printf_escaped("00:0%i", duration);
else
res = g_markup_printf_escaped("00:%i", duration);
if( duration < 10 ) {
g_snprintf(call->_timestr, 20, "00:0%d", duration);
}
else {
g_snprintf(call->_timestr, 20, "00:%d", duration);
}
}
else
{
if( duration%60 < 10 )
res = g_markup_printf_escaped("%i:0%i" , duration/60 , duration%60);
else
res = g_markup_printf_escaped("%i:%i" , duration/60 , duration%60);
if( duration%60 < 10 ) {
g_snprintf(call->_timestr, 20, "0%d:0%d", duration/60, duration%60);
}
else {
g_snprintf(call->_timestr, 20, "%d:%d", duration/60, duration%60);
}
}
// return g_markup_printf_escaped("<small>Duration:</small> %s", res);
DEBUG("%s", res);
calltree_update_clock(call);
calltree_update_clock();
g_free(res);
gdk_threads_leave ();
sleep(1);
}
......@@ -201,6 +204,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));
g_snprintf(obj->_timestr, 20, "00:00");
if (g_strcasecmp (callID, "") == 0)
call_id = generate_call_id ();
......
......@@ -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[20]; // 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 *);
......
......@@ -41,6 +41,7 @@
#include <shortcuts-config.h>
#include <audioconf.h>
#include <hooks-config.h>
#include <audioconf.h>
/**
* Local variables
......
......@@ -1406,12 +1406,17 @@ void calltree_display (calltab_t *tab) {
}
void
calltree_update_clock(callable_obj_t *c) {
DEBUG("UPDATE CLOCK");
void calltree_update_clock() {
if(!selected_call)
return;
if(!(selected_call->_timestr))
return;
// TODO this make the whole thing crash...
// calltree_update_call(current_calls, c, NULL);
statusbar_update_clock(selected_call->_timestr);
}
......
......@@ -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
......@@ -145,9 +145,9 @@ call_state_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* state,
calltree_update_call(history, c, NULL);
}
stop_notification();
sflphone_hung_up(c);
calltree_update_call(history, c, NULL );
calltree_update_call(history, c, NULL);
status_bar_display_account();
sflphone_hung_up(c);
}
else if (strcmp(state, "UNHOLD_CURRENT") == 0)
{
......
......@@ -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)
{
......@@ -405,22 +412,63 @@ main_window_volume_controls (gboolean state)
}
void
statusbar_push_message (const gchar * message, guint id)
statusbar_push_message (const gchar *left_hand_message, const gchar *right_hand_message, guint id)
{
gtk_statusbar_push (GTK_STATUSBAR(statusBar), id, message);
// The actual message to be push in the statusbar
gchar *message_to_display;
pthread_mutex_lock(&statusbar_message_mutex);
g_free(status_current_message);
// store the left hand message so that it can be reused in case of clock update
status_current_message = g_strdup(left_hand_message);
// 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);
else
message_to_display = g_strdup(left_hand_message);
// Push into the statusbar
gtk_statusbar_push (GTK_STATUSBAR(statusBar), id, message_to_display);
g_free(message_to_display);
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 = NULL;
pthread_mutex_lock(&statusbar_message_mutex);
message = g_strdup(status_current_message);
pthread_mutex_unlock(&statusbar_message_mutex);
if(message) {
statusbar_pop_message(__MSG_ACCOUNT_DEFAULT);
statusbar_push_message(message, msg, __MSG_ACCOUNT_DEFAULT);
}
g_free(message);
message = NULL;
}
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
......
......@@ -94,10 +94,11 @@ void main_window_info_message(gchar * markup);
/**
* Push a message on the statusbar stack
* @param message The message to display
* @param left_hand_message The message to display on the left side
* @param right_hand_message The message to display on the right side
* @param id The identifier of the message
*/
void statusbar_push_message( const gchar* message , guint id );
void statusbar_push_message( const gchar *left_hand_message, const gchar *right_hand_message, guint id );
/**
* Pop a message from the statusbar stack
......@@ -105,6 +106,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);
......
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