Commit d7360c35 authored by Emmanuel Milou's avatar Emmanuel Milou

Add switching account from the main window

With a right- click when dialing
parent cd66e363
......@@ -24,6 +24,7 @@
GQueue * accountQueue;
gchar * DEFAULT_ACCOUNT=NULL;
gchar * CURRENT_ACCOUNT=NULL;
/* GCompareFunc to compare a accountID (gchar* and a account_t) */
gint
......@@ -139,6 +140,18 @@ account_list_set_default(const gchar * accountID)
g_print("DEFAULT_ACCOUNT = %s\n", DEFAULT_ACCOUNT);
}
gchar *
account_list_get_current( )
{
return CURRENT_ACCOUNT;
}
void
account_list_set_current(const gchar * accountID)
{
CURRENT_ACCOUNT = g_strdup(accountID);
}
const gchar * account_state_name(account_state_t s)
{
gchar * state;
......
......@@ -111,6 +111,16 @@ gchar * account_list_get_default( );
*/
void account_list_set_default(const gchar * accountID);
/** Return the current account id
* @return The current account id
*/
gchar * account_list_get_current( );
/** This function sets an account as the current one
* @param accountID The ID of the current account
*/
void account_list_set_current(const gchar * accountID);
/** This function maps account_state_t enums to a description.
* @param s The state
* @return The full text description of the state */
......
......@@ -88,7 +88,7 @@ status_bar_display_account( call_t* c)
acc = account_list_get_by_id(c->accountID);
else
acc = account_list_get_by_id( account_list_get_default());
msg = g_markup_printf_escaped("%s account: %s" ,
msg = g_markup_printf_escaped("Default: %s account- %s" ,
g_hash_table_lookup( acc->properties , ACCOUNT_TYPE),
g_hash_table_lookup( acc->properties , ACCOUNT_ALIAS));
status_bar_message_add( msg , __MSG_ACCOUNT_DEFAULT);
......@@ -585,14 +585,20 @@ sflphone_place_call ( call_t * c )
if(c->state == CALL_STATE_DIALING)
{
account_t * account;
gchar * default_account = account_list_get_default();
account = account_list_get_by_id(default_account);
gchar* account_id = account_list_get_current();
if( account_id == NULL ){
account_id = account_list_get_default();
account = account_list_get_by_id(account_id);
}
else
account = account_list_get_by_id( account_id );
// Here : account_id is either the default one, either the current one selected with a right-click
if(account)
{
if(strcmp(g_hash_table_lookup(account->properties, "Status"),"REGISTERED")==0)
{
c->accountID = default_account;
c->accountID = account_id;
dbus_place_call(c);
}
else
......
This diff is collapsed.
......@@ -1461,7 +1461,6 @@ ManagerImpl::isStartHidden( void )
void
ManagerImpl::switchPopupMode( void )
{
_debug("Switch popup mode\n");
( getConfigInt( PREFERENCES , CONFIG_POPUP ) == WINDOW_POPUP)? setConfig(PREFERENCES , CONFIG_POPUP , NO_STR ) : setConfig( PREFERENCES , CONFIG_POPUP , YES_STR );
}
......
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