Skip to content
Snippets Groups Projects
Commit 6ebdd55b authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Save and use the new mailbox number in case

parent 76aea366
No related branches found
No related tags found
No related merge requests found
......@@ -138,6 +138,7 @@ account_list_get_current( )
void
account_list_set_current_id(const gchar * accountID)
{
g_print("set current id = %d\n" , accountID);
__CURRENT_ACCOUNT_ID = g_strdup(accountID);
}
......@@ -208,3 +209,17 @@ account_list_move_down(guint index)
}
account_list_set_current_pos( 0 );
}
guint
account_list_get_registered_accounts( void )
{
guint res = 0;
int i;
for(i=0;i<account_list_get_size();i++)
{
if( account_list_get_nth( i ) -> state == ( ACCOUNT_STATE_REGISTERED ))
res ++;
}
g_print(" %d registered accounts \n" , res );
return res;
}
......@@ -94,6 +94,11 @@ void account_list_remove (const gchar * accountID);
*/
account_t * account_list_get_by_state ( account_state_t state);
/**
* @return guint The number of registered accounts in the list
*/
guint account_list_get_registered_accounts( );
/**
* Return the number of accounts in the list
* @return guint The number of accounts in the list
......
......@@ -388,9 +388,11 @@ show_account_window (account_t * a)
/** @todo Verify if it's the best condition to check */
if (currentAccount->accountID == NULL) {
dbus_add_account(currentAccount);
account_list_set_current_id( currentAccount->accountID);
}
else {
dbus_set_account_details(currentAccount);
account_list_set_current_id( currentAccount->accountID);
}
}
gtk_widget_destroy (GTK_WIDGET(dialog));
......
......@@ -164,9 +164,8 @@ call_mailbox( GtkWidget* widget , gpointer data )
mailboxCall->callID = g_new0(gchar, 30);
g_sprintf(mailboxCall->callID, "%d", rand());
//mailboxCall->to = g_strdup(current->mailbox_number);
mailboxCall->to = g_strdup("888");
mailboxCall->to = g_strdup(g_hash_table_lookup(current->properties, ACCOUNT_MAILBOX));
mailboxCall->accountID = g_strdup(current->accountID);
printf("call : from : %s to %s\n", mailboxCall->from, mailboxCall->to);
call_list_add( current_calls , mailboxCall );
update_call_tree_add( current_calls , mailboxCall );
update_menus();
......@@ -181,6 +180,7 @@ toolbar_update_buttons ()
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(holdButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(mailboxButton) , TRUE );
gtk_widget_set_sensitive( GTK_WIDGET(unholdButton), FALSE);
g_object_ref(holdButton);
g_object_ref(unholdButton);
......@@ -262,6 +262,7 @@ toolbar_update_buttons ()
else
{
gtk_widget_set_sensitive( GTK_WIDGET(callButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(mailboxButton), FALSE);
}
}
}
......@@ -388,11 +389,10 @@ create_toolbar (){
history_shown = FALSE;
active_calltree = current_calls;
//image = gtk_image_new_from_file( ICONS_DIR "/stock_mail-unread.svg");
mailboxButton = gtk_toggle_tool_button_new_from_stock( GTK_STOCK_HOME );
//gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(mailboxButton), image);
if( account_list_get_size() ==0 ) gtk_widget_set_state( GTK_WIDGET(mailboxButton), GTK_STATE_INSENSITIVE );
gtk_widget_set_tooltip_text(GTK_WIDGET(mailboxButton), _("Mail Box"));
gtk_tool_button_set_label(GTK_TOOL_BUTTON(transfertButton), _("Mail Box"));
gtk_tool_button_set_label(GTK_TOOL_BUTTON(mailboxButton), _("Mail Box"));
g_signal_connect (G_OBJECT (mailboxButton), "toggled",
G_CALLBACK (call_mailbox), NULL);
gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(mailboxButton), -1);
......
......@@ -1371,5 +1371,8 @@ show_accounts_window( void )
dialogOpen=FALSE;
gtk_widget_destroy(GTK_WIDGET(dialog));
if( account_list_get_size() >0 && account_list_get_current()==NULL )
account_list_set_current_pos(0);
toolbar_update_buttons();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment