Improve account window

This commit is contained in:
Emmanuel Milou
2008-04-25 18:13:46 -04:00
parent 46666b3cc3
commit a460c17e07
13 changed files with 266 additions and 288 deletions

View File

@ -29,33 +29,23 @@
account_t * currentAccount;
GtkDialog * dialog;
GtkWidget * hbox;
GtkWidget * frame;
GtkWidget * frameNat;
GtkWidget * table;
GtkWidget * tableNat;
GtkWidget * label;
GtkWidget * entryID;
GtkWidget * entryName;
GtkWidget * entryAlias;
GtkWidget * entryProtocol;
GtkWidget * entryEnabled;
//GtkWidget * entryRegister;
GtkWidget * entryFullName;
GtkWidget * entryUserPart;
GtkWidget * entryHostPart;
GtkWidget * entryUsername;
GtkWidget * entryHostname;
GtkWidget * entryPassword;
GtkWidget * stunServer;
GtkWidget * stunEnable;
GtkWidget * entryMailbox;
/**
* Delete an account
*/
/*static void
delete_account( GtkWidget *widget, gpointer data )
{
sflphone_remove_account(currentAccount);
}*/
/* Signal to entryProtocol 'changed' */
void
change_protocol (account_t * currentAccount)
@ -65,12 +55,10 @@ change_protocol (account_t * currentAccount)
// toggle sensitivity for: entryUserPart
if (strcmp(proto, "SIP") == 0) {
gtk_widget_set_sensitive( GTK_WIDGET(entryUserPart), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(stunEnable), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(stunServer), TRUE);
}
else if (strcmp(proto, "IAX") == 0) {
gtk_widget_set_sensitive( GTK_WIDGET(entryUserPart), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(stunEnable), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(stunServer), FALSE);
}
@ -109,11 +97,10 @@ show_account_window (account_t * a)
gchar * curAccountID = "";
gchar * curAccountEnabled = "TRUE";
gchar * curAccountType = "SIP";
gchar * curUserPart = "";
gchar * curHostPart = "";
gchar * curPassword = "";
gchar * curAlias = "";
gchar * curUsername = "";
gchar * curFullName = "";
gchar * curHostname = "";
gchar * curPassword = "";
/* TODO: add curProxy, and add boxes for Proxy support */
gchar * stun_enabled = "FALSE";
gchar * stun_server= "stun.fwdnet.net:3478";
@ -125,20 +112,18 @@ show_account_window (account_t * a)
curAccountID = a->accountID;
curAccountType = g_hash_table_lookup(currentAccount->properties, ACCOUNT_TYPE);
curAccountEnabled = g_hash_table_lookup(currentAccount->properties, ACCOUNT_ENABLED);
curAlias = g_hash_table_lookup(currentAccount->properties, ACCOUNT_ALIAS);
if (strcmp(curAccountType, "IAX") == 0) {
curHostPart = g_hash_table_lookup(currentAccount->properties, ACCOUNT_IAX_HOST);
curPassword = g_hash_table_lookup(currentAccount->properties, ACCOUNT_IAX_PASS);
curHostname = g_hash_table_lookup(currentAccount->properties, ACCOUNT_IAX_HOST);
curPassword = g_hash_table_lookup(currentAccount->properties, ACCOUNT_IAX_PASSWORD);
curUsername = g_hash_table_lookup(currentAccount->properties, ACCOUNT_IAX_USER);
curFullName = g_hash_table_lookup(currentAccount->properties, ACCOUNT_IAX_FULL_NAME);
curMailbox = g_hash_table_lookup(currentAccount->properties, ACCOUNT_MAILBOX);
}
else if (strcmp(curAccountType, "SIP") == 0) {
curHostPart = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_HOST_PART);
curHostname = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_HOST);
curPassword = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_PASSWORD);
curUsername = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_AUTH_NAME);
curFullName = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_FULL_NAME);
curUserPart = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_USER_PART);
curUsername = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_USER);
stun_enabled = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_STUN_ENABLED);
stun_server = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_STUN_SERVER);
curMailbox = g_hash_table_lookup(currentAccount->properties, ACCOUNT_MAILBOX);
@ -163,9 +148,17 @@ show_account_window (account_t * a)
gtk_dialog_set_has_separator(dialog, TRUE);
gtk_container_set_border_width (GTK_CONTAINER(dialog), 0);
table = gtk_table_new ( 8, 4 , FALSE/* homogeneous */);
frame = gtk_frame_new( "Account parameters" );
gtk_box_pack_start(GTK_BOX(dialog->vbox), frame, FALSE, FALSE, 0);
gtk_widget_show(frame);
table = gtk_table_new ( 8, 2 , FALSE/* homogeneous */);
gtk_table_set_row_spacings( GTK_TABLE(table), 10);
gtk_table_set_col_spacings( GTK_TABLE(table), 10);
gtk_box_pack_start(GTK_BOX (frame), table, TRUE, TRUE, 0);
gtk_widget_show(table);
gtk_container_add( GTK_CONTAINER( frame) , table );
#ifdef DEBUG
label = gtk_label_new_with_mnemonic ("ID:");
@ -184,25 +177,19 @@ show_account_window (account_t * a)
gtk_table_attach ( GTK_TABLE( table ), entryEnabled, 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_set_sensitive( GTK_WIDGET( entryEnabled ) , TRUE );
//entryRegister = gtk_check_button_new_with_mnemonic("_Register on startup ");
//gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(entryRegister),
// strcmp(g_hash_table_lookup(currentAccount->properties, ACCOUNT_REGISTER),"TRUE") == 0 ? TRUE: FALSE);
//gtk_table_attach ( GTK_TABLE( table ), entryRegister, 0, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
label = gtk_label_new_with_mnemonic (_("_Alias"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
entryName = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryName);
gtk_entry_set_text(GTK_ENTRY(entryName), g_hash_table_lookup(currentAccount->properties, ACCOUNT_ALIAS));
gtk_table_attach ( GTK_TABLE( table ), entryName, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
entryAlias = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryAlias);
gtk_entry_set_text(GTK_ENTRY(entryAlias), g_hash_table_lookup(currentAccount->properties, ACCOUNT_ALIAS));
gtk_table_attach ( GTK_TABLE( table ), entryAlias, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
label = gtk_label_new_with_mnemonic (_("_Protocol"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
entryProtocol = gtk_combo_box_new_text();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryProtocol);
//gtk_widget_set_sensitive( GTK_WIDGET(entryProtocol), TRUE);
gtk_combo_box_append_text(GTK_COMBO_BOX(entryProtocol), "SIP");
if( is_iax_enabled() ) gtk_combo_box_append_text(GTK_COMBO_BOX(entryProtocol), "IAX");
if(strcmp(curAccountType, "SIP") == 0)
@ -226,75 +213,68 @@ show_account_window (account_t * a)
G_CALLBACK (change_protocol),
currentAccount);
label = gtk_label_new_with_mnemonic (_("_Full Name"));
label = gtk_label_new_with_mnemonic (_("_Hostname "));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 5, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
entryFullName = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryFullName);
gtk_entry_set_text(GTK_ENTRY(entryFullName), curFullName);
gtk_table_attach ( GTK_TABLE( table ), entryFullName, 1, 2, 5, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
label = gtk_label_new_with_mnemonic (_("_User part"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
entryUserPart = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryUserPart);
gtk_entry_set_text(GTK_ENTRY(entryUserPart), curUserPart);
gtk_table_attach ( GTK_TABLE( table ), entryUserPart, 1, 2, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
label = gtk_label_new_with_mnemonic (_("_Host part"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 7, 8, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
entryHostPart = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryHostPart);
gtk_entry_set_text(GTK_ENTRY(entryHostPart), curHostPart);
gtk_table_attach ( GTK_TABLE( table ), entryHostPart, 1, 2, 7, 8, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
entryHostname = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryHostname);
gtk_entry_set_text(GTK_ENTRY(entryHostname), curHostname);
gtk_table_attach ( GTK_TABLE( table ), entryHostname, 1, 2, 5, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
label = gtk_label_new_with_mnemonic (_("U_sername"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 8, 9, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
entryUsername = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryUsername);
gtk_entry_set_text(GTK_ENTRY(entryUsername), curUsername);
gtk_table_attach ( GTK_TABLE( table ), entryUsername, 1, 2, 8, 9, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach ( GTK_TABLE( table ), entryUsername, 1, 2, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
label = gtk_label_new_with_mnemonic (_("_Password"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 9, 10, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 7, 8, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
entryPassword = gtk_entry_new();
gtk_entry_set_visibility(GTK_ENTRY(entryPassword), FALSE);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryPassword);
gtk_entry_set_text(GTK_ENTRY(entryPassword), curPassword);
gtk_table_attach ( GTK_TABLE( table ), entryPassword, 1, 2, 9, 10, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach ( GTK_TABLE( table ), entryPassword, 1, 2, 7, 8, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
label = gtk_label_new_with_mnemonic (_("_Mailbox"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 10, 11, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 8, 9, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
entryMailbox = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryMailbox);
gtk_entry_set_text(GTK_ENTRY(entryMailbox), curMailbox);
gtk_table_attach ( GTK_TABLE( table ), entryMailbox, 1, 2, 10, 11, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach ( GTK_TABLE( table ), entryMailbox, 1, 2, 8, 9, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show_all( table );
gtk_container_set_border_width (GTK_CONTAINER(table), 10);
frameNat = gtk_frame_new( _("NAT detection") );
gtk_box_pack_start(GTK_BOX(dialog->vbox), frameNat, FALSE, FALSE, 0);
gtk_widget_show(frameNat);
tableNat = gtk_table_new ( 2, 2 , FALSE/* homogeneous */);
gtk_table_set_row_spacings( GTK_TABLE(tableNat), 10);
gtk_table_set_col_spacings( GTK_TABLE(tableNat), 10);
gtk_box_pack_end(GTK_BOX (frameNat), tableNat, TRUE, TRUE, 0);
gtk_widget_show(tableNat);
gtk_container_add( GTK_CONTAINER( frameNat) , tableNat );
// NAT detection code section
label = gtk_label_new("");
gtk_label_set_markup(GTK_LABEL( label ),_("<b>NAT Detection</b>"));
gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
stunEnable = gtk_check_button_new_with_mnemonic(_("E_nable STUN"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stunEnable),
strcmp(stun_enabled,"TRUE") == 0 ? TRUE: FALSE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stunEnable), strcmp(stun_enabled,"TRUE") == 0 ? TRUE: FALSE);
g_signal_connect( G_OBJECT (GTK_TOGGLE_BUTTON(stunEnable)) , "toggled" , G_CALLBACK( stun_state ), NULL);
gtk_widget_set_tooltip_text( GTK_WIDGET( stunEnable ) , _("Enable it if you are behind a firewall, then restart SFLphone"));
gtk_table_attach ( GTK_TABLE( table ), stunEnable, 3, 4, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach ( GTK_TABLE( tableNat ), stunEnable, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
label = gtk_label_new_with_mnemonic(_("S_TUN Server"));
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 5, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach( GTK_TABLE( tableNat ), label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
stunServer = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), stunServer);
gtk_entry_set_text(GTK_ENTRY(stunServer), stun_server);
gtk_widget_set_tooltip_text( GTK_WIDGET( stunServer ) , _("Format: name.server:port"));
gtk_table_attach ( GTK_TABLE( table ), stunServer, 3, 4, 5, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach ( GTK_TABLE( tableNat ), stunServer, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_set_sensitive( GTK_WIDGET( stunServer ), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(stunEnable)));
@ -303,7 +283,6 @@ show_account_window (account_t * a)
//gtk_widget_set_sesitive( GTK_WIDGET(entryUserPart), TRUE);<
}
else if (strcmp(curAccountType, "IAX") == 0) {
gtk_widget_set_sensitive( GTK_WIDGET(entryUserPart), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(stunEnable), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(stunServer), FALSE);
}
@ -313,10 +292,9 @@ show_account_window (account_t * a)
}
gtk_box_pack_start (GTK_BOX (dialog->vbox), table, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER(table), 10);
gtk_widget_show_all(table);
gtk_widget_show_all( tableNat );
gtk_container_set_border_width (GTK_CONTAINER(tableNat), 10);
response = gtk_dialog_run (GTK_DIALOG (dialog));
if(response == GTK_RESPONSE_ACCEPT)
@ -326,30 +304,20 @@ show_account_window (account_t * a)
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_ENABLED),
g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(entryEnabled)) ? "TRUE": "FALSE"));
// g_hash_table_replace(currentAccount->properties,
// g_strdup(ACCOUNT_REGISTER),
// g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(entryRegister)) ? "TRUE": "FALSE"));
/* TODO Add SIP/IAX when IAX is ok */
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_ALIAS),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryName))));
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryAlias))));
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_TYPE),
g_strdup(proto));
if (strcmp(proto, "SIP") == 0) { /* Protocol = SIP */
if (strcmp(proto, "SIP") == 0) {
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_SIP_FULL_NAME),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryFullName))));
g_strdup(ACCOUNT_SIP_HOST),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryHostname))));
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_SIP_USER_PART),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryUserPart))));
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_SIP_HOST_PART),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryHostPart))));
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_SIP_AUTH_NAME),
g_strdup(ACCOUNT_SIP_USER),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryUsername))));
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_SIP_PASSWORD),
@ -364,18 +332,15 @@ show_account_window (account_t * a)
g_strdup(ACCOUNT_MAILBOX),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryMailbox))));
}
else if (strcmp(proto, "IAX") == 0) { /* Protocol = IAX */
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_IAX_FULL_NAME),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryFullName))));
else if (strcmp(proto, "IAX") == 0) {
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_IAX_HOST),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryHostPart))));
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryHostname))));
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_IAX_USER),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryUsername))));
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_IAX_PASS),
g_strdup(ACCOUNT_IAX_PASSWORD),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryPassword))));
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_MAILBOX),
@ -396,7 +361,4 @@ show_account_window (account_t * a)
}
}
gtk_widget_destroy (GTK_WIDGET(dialog));
}

View File

@ -30,6 +30,7 @@
#include <marshaller.h>
#include <sliders.h>
#include <statusicon.h>
#include <druid.h>
#include <dbus.h>
#include <actions.h>

View File

@ -19,139 +19,165 @@
#include <druid.h>
static struct _wizard *wiz;
struct _wizard *wiz;
static int account_type;
account_t* current;
void
build_account_configuration( int type )
build_sip_account_configuration( void )
{
// table
wiz->table = gtk_table_new ( 8, 4 , FALSE/* homogeneous */);
gtk_table_set_row_spacings( GTK_TABLE(wiz->table), 10);
gtk_table_set_col_spacings( GTK_TABLE(wiz->table), 10);
if( type == _SIP )
gtk_box_pack_start(GTK_BOX(GNOME_DRUID_PAGE_STANDARD(wiz->sip_account)->vbox),wiz->table, TRUE, TRUE, 2);
else
gtk_box_pack_start(GTK_BOX(GNOME_DRUID_PAGE_STANDARD(wiz->iax_account)->vbox),wiz->table, TRUE, TRUE, 2);
wiz->sip_table = gtk_table_new ( 4, 2 , FALSE/* homogeneous */);
gtk_table_set_row_spacings( GTK_TABLE(wiz->sip_table), 10);
gtk_table_set_col_spacings( GTK_TABLE(wiz->sip_table), 10);
gtk_box_pack_start(GTK_BOX(GNOME_DRUID_PAGE_STANDARD(wiz->sip_account)->vbox),wiz->sip_table, TRUE, TRUE, 2);
// alias field
wiz->label = gtk_label_new_with_mnemonic ("_Alias");
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->label, 0, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach ( GTK_TABLE( wiz->sip_table ), wiz->label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (wiz->label), 0, 0.5);
wiz->alias = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->alias);
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->alias, 2, 4, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
// name field
wiz->label = gtk_label_new_with_mnemonic ("_Name");
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->label, 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (wiz->label), 0, 0.5);
wiz->name = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->name);
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->name, 2, 4, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
if( type == _SIP )
{
// user part field
wiz->label = gtk_label_new_with_mnemonic ("_Userpart");
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->label, 0, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (wiz->label), 0, 0.5);
wiz->userpart = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->userpart);
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->userpart, 2, 4, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
}
wiz->sip_alias = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->sip_alias);
gtk_table_attach ( GTK_TABLE( wiz->sip_table ), wiz->sip_alias, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
// server field
wiz->label = gtk_label_new_with_mnemonic ("_Server");
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->label, 0, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
wiz->label = gtk_label_new_with_mnemonic ("_Host name");
gtk_table_attach ( GTK_TABLE( wiz->sip_table ), wiz->label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (wiz->label), 0, 0.5);
wiz->server = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->server);
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->server, 2, 4, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
wiz->sip_server = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->sip_server);
gtk_table_attach ( GTK_TABLE( wiz->sip_table ), wiz->sip_server, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
// username field
wiz->label = gtk_label_new_with_mnemonic ("_Username");
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->label, 0, 2, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
wiz->label = gtk_label_new_with_mnemonic ("_User name");
gtk_table_attach ( GTK_TABLE( wiz->sip_table ), wiz->label, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (wiz->label), 0, 0.5);
wiz->username = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->username);
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->username, 2, 4, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
wiz->sip_username = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->sip_username);
gtk_table_attach ( GTK_TABLE( wiz->sip_table ), wiz->sip_username, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
// password field
wiz->label = gtk_label_new_with_mnemonic ("_Password");
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->label, 0, 2, 5, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach ( GTK_TABLE( wiz->sip_table ), wiz->label, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (wiz->label), 0, 0.5);
wiz->password = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->password);
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->password, 2, 4, 5, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
wiz->sip_password = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->sip_password);
gtk_table_attach ( GTK_TABLE( wiz->sip_table ), wiz->sip_password, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
// mailbox field
wiz->label = gtk_label_new_with_mnemonic ("_Mailbox");
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->label, 0, 2, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (wiz->label), 0, 0.5);
wiz->mailbox = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->mailbox);
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->mailbox, 2, 4, 6, 7, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ALIAS), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->sip_alias))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ENABLED), g_strdup("TRUE"));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_MAILBOX), g_strdup("888"));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_TYPE), g_strdup("SIP"));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_HOST), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->sip_server))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_PASSWORD), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->sip_password))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_USER), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->sip_username))));
current -> state = ACCOUNT_STATE_UNREGISTERED;
}
void
build_iax_account_configuration( void )
{
// table
wiz->iax_table = gtk_table_new ( 4, 2 , FALSE/* homogeneous */);
gtk_table_set_row_spacings( GTK_TABLE(wiz->iax_table), 10);
gtk_table_set_col_spacings( GTK_TABLE(wiz->iax_table), 10);
gtk_box_pack_start(GTK_BOX(GNOME_DRUID_PAGE_STANDARD(wiz->iax_account)->vbox),wiz->iax_table, TRUE, TRUE, 2);
// alias field
wiz->label = gtk_label_new_with_mnemonic ("_Alias");
gtk_table_attach ( GTK_TABLE( wiz->iax_table ), wiz->label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (wiz->label), 0, 0.5);
wiz->iax_alias = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->iax_alias);
gtk_table_attach ( GTK_TABLE( wiz->iax_table ), wiz->iax_alias, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
// server field
wiz->label = gtk_label_new_with_mnemonic ("_Host name");
gtk_table_attach ( GTK_TABLE( wiz->iax_table ), wiz->label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (wiz->label), 0, 0.5);
wiz->iax_server = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->iax_server);
gtk_table_attach ( GTK_TABLE( wiz->iax_table ), wiz->iax_server, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
// username field
wiz->label = gtk_label_new_with_mnemonic ("_User name");
gtk_table_attach ( GTK_TABLE( wiz->iax_table ), wiz->label, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (wiz->label), 0, 0.5);
wiz->iax_username = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->iax_username);
gtk_table_attach ( GTK_TABLE( wiz->iax_table ), wiz->iax_username, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
// password field
wiz->label = gtk_label_new_with_mnemonic ("_Password");
gtk_table_attach ( GTK_TABLE( wiz->iax_table ), wiz->label, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (wiz->label), 0, 0.5);
wiz->iax_password = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->iax_password);
gtk_table_attach ( GTK_TABLE( wiz->iax_table ), wiz->iax_password, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_ALIAS), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_alias))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_ENABLED), g_strdup("TRUE"));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_MAILBOX), g_strdup("888"));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_TYPE), g_strdup("IAX"));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_IAX_USER), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_username))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_IAX_HOST), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_server))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_IAX_PASSWORD), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_password))));
current -> state = ACCOUNT_STATE_UNREGISTERED;
}
void
update_account_parameters( int type )
{
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_ALIAS), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->alias))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ALIAS), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_alias))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ENABLED), g_strdup("TRUE"));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_MAILBOX), g_strdup("888"));
if( type == _SIP ){
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_SIP_FULL_NAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->name))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_SIP_USER_PART), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->userpart))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_SIP_HOST_PART), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->server))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_SIP_PASSWORD), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->password))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_SIP_AUTH_NAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->username))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_SIP_STUN_ENABLED), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->enable))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_SIP_STUN_SERVER), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->addr))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_MAILBOX), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->mailbox))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_TYPE), g_strdup("SIP"));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_HOST), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_server))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_PASSWORD), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_password))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_USER), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_username))));
//g_hash_table_replace(current->properties, g_strdup(ACCOUNT_SIP_STUN_ENABLED), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_enable))));
//g_hash_table_replace(current->properties, g_strdup(ACCOUNT_SIP_STUN_SERVER), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_addr))));
}
else if( type == _IAX ){
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_IAX_FULL_NAME), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->name))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_IAX_USER), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->username))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_IAX_HOST), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->server))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_IAX_PASS), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->password))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_MAILBOX), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->mailbox))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_TYPE), g_strdup("IAX"));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_IAX_USER), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_username))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_IAX_HOST), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_server))));
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_IAX_PASSWORD), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->iax_password))));
}
//dbus_add_account(current);
current -> state = ACCOUNT_STATE_UNREGISTERED;
}
void
build_nat_window( void )
{
// table
wiz->table = gtk_table_new ( 2, 4 , FALSE/* homogeneous */);
gtk_table_set_row_spacings( GTK_TABLE(wiz->table), 10);
gtk_table_set_col_spacings( GTK_TABLE(wiz->table), 10);
gtk_box_pack_start(GTK_BOX(GNOME_DRUID_PAGE_STANDARD(wiz->nat)->vbox),wiz->table, TRUE, TRUE, 2);
wiz->nat_table = gtk_table_new ( 2, 2 , FALSE/* homogeneous */);
gtk_table_set_row_spacings( GTK_TABLE(wiz->nat_table), 10);
gtk_table_set_col_spacings( GTK_TABLE(wiz->nat_table), 10);
gtk_box_pack_start(GTK_BOX(GNOME_DRUID_PAGE_STANDARD(wiz->nat)->vbox),wiz->nat_table, TRUE, TRUE, 2);
// enable
wiz->enable = gtk_check_button_new_with_mnemonic("_Enabled");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wiz->enable), FALSE);
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->enable, 0, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach ( GTK_TABLE( wiz->nat_table ), wiz->enable, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_set_sensitive( GTK_WIDGET( wiz->enable ) , TRUE );
g_signal_connect( G_OBJECT( GTK_TOGGLE_BUTTON(wiz->enable)) , "toggled" , G_CALLBACK( enable_stun ), NULL);
// server address
wiz->label = gtk_label_new_with_mnemonic ("_Server address");
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->label, 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach ( GTK_TABLE( wiz->nat_table ), wiz->label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (wiz->label), 0, 0.5);
wiz->addr = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (wiz->label), wiz->addr);
gtk_table_attach ( GTK_TABLE( wiz->table ), wiz->addr, 2, 4, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach ( GTK_TABLE( wiz->nat_table ), wiz->addr, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_set_sensitive( GTK_WIDGET( wiz->addr ), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wiz->enable)));
}
void
build_registration_test( void )
{
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_STUN_ENABLED), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->enable))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_STUN_SERVER), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(wiz->addr))));
}
void
@ -160,10 +186,8 @@ set_account_type( GtkWidget* widget , gpointer data )
if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( widget )) ){
account_type = _SIP;
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_TYPE), g_strdup("SIP"));
}else{
account_type = _IAX ;
g_hash_table_replace(current->properties, g_strdup(ACCOUNT_TYPE), g_strdup("IAX"));
}
}
@ -191,14 +215,12 @@ goto_accounts_page( void )
void
goto_nat_page( void )
{
update_account_parameters( _SIP );
gnome_druid_set_page( GNOME_DRUID( wiz->druid ) , GNOME_DRUID_PAGE( wiz->nat));
gnome_druid_set_page( GNOME_DRUID( wiz->druid ) , GNOME_DRUID_PAGE( wiz->nat));
}
void
goto_end_page( void )
{
dbus_add_account( current );
gnome_druid_set_page( GNOME_DRUID( wiz->druid ) , GNOME_DRUID_PAGE( wiz->page_end));
}
@ -214,13 +236,42 @@ quit_wizard( void )
return;
}
void
send_registration( void )
{
dbus_add_account( current );
//sleep(1);
switch( current->state )
{
case ACCOUNT_STATE_REGISTERED:
gnome_druid_page_edge_set_text( GNOME_DRUID_PAGE_EDGE( wiz->page_end )," Congratulations! \n\n You have been successfully registered. Answer the call! " );
break;
case ACCOUNT_STATE_UNREGISTERED:
gnome_druid_page_edge_set_text( GNOME_DRUID_PAGE_EDGE( wiz->page_end )," You are not registered! \n\n And we don't know why! " );
break;
case ACCOUNT_STATE_ERROR_AUTH:
gnome_druid_page_edge_set_text( GNOME_DRUID_PAGE_EDGE( wiz->page_end )," You are not registered! \n\n Authentification error. Please try again " );
break;
case ACCOUNT_STATE_ERROR_HOST:
gnome_druid_page_edge_set_text( GNOME_DRUID_PAGE_EDGE( wiz->page_end )," You are not registered! \n\n The host name you specified is unreachable. Please try again " );
break;
case ACCOUNT_STATE_ERROR_NETWORK:
gnome_druid_page_edge_set_text( GNOME_DRUID_PAGE_EDGE( wiz->page_end )," You are not registered! \n\n The network is unreachable. Check the plug " );
break;
default:
gnome_druid_page_edge_set_text( GNOME_DRUID_PAGE_EDGE( wiz->page_end )," Sorry we cannot status your case " );
}
goto_end_page();
}
void
build_wizard( void )
{
wiz = ( struct _wizard* )g_malloc( sizeof( struct _wizard));
current = g_new0(account_t, 1);
current->properties = g_hash_table_new(NULL, g_str_equal);
current ->accountID = "test";
wiz->logo = gdk_pixbuf_new_from_file(ICON_DIR "/sflphone.png", NULL);
wiz->druid = gnome_druid_new_with_window( "SFLphone" , NULL , TRUE , &wiz->window );
@ -241,21 +292,21 @@ build_wizard( void )
gtk_box_pack_start( GTK_BOX(wiz->protocols) , wiz->sip , TRUE, TRUE, 0);
wiz->iax = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(wiz->sip), "IAX2 (InterAsterix Exchange)");
gtk_box_pack_start( GTK_BOX(wiz->protocols) , wiz->iax , TRUE, TRUE, 0);
g_signal_connect(G_OBJECT( wiz->sip ) , "clicked" , G_CALLBACK( set_account_type ) , NULL);
g_signal_connect(G_OBJECT( wiz->sip ) , "clicked" , G_CALLBACK( set_account_type ) , NULL );
/** Page 2 */
wiz->sip_account = gnome_druid_page_standard_new();
gnome_druid_page_standard_set_title( GNOME_DRUID_PAGE_STANDARD( wiz->sip_account), "SIP account configuration");
gnome_druid_page_standard_set_logo( GNOME_DRUID_PAGE_STANDARD( wiz->sip_account) , wiz->logo );
gnome_druid_append_page( GNOME_DRUID( wiz->druid ) , GNOME_DRUID_PAGE( wiz->sip_account ));
build_account_configuration( _SIP );
build_sip_account_configuration( );
/** Page 3 */
wiz->iax_account = gnome_druid_page_standard_new();
gnome_druid_page_standard_set_title( GNOME_DRUID_PAGE_STANDARD( wiz->iax_account), "IAX2 account configuration");
gnome_druid_page_standard_set_logo( GNOME_DRUID_PAGE_STANDARD( wiz->iax_account) , wiz->logo );
gnome_druid_append_page( GNOME_DRUID( wiz->druid ) , GNOME_DRUID_PAGE( wiz->iax_account ));
build_account_configuration( _IAX );
build_iax_account_configuration( );
/** Page 4 */
wiz->nat = gnome_druid_page_standard_new();
@ -269,8 +320,8 @@ build_wizard( void )
gnome_druid_page_edge_set_title( GNOME_DRUID_PAGE_EDGE( wiz->page_end), "Account Registration");
gnome_druid_page_edge_set_logo( GNOME_DRUID_PAGE_EDGE( wiz->page_end) , wiz->logo );
gnome_druid_append_page( GNOME_DRUID( wiz->druid ) , GNOME_DRUID_PAGE( wiz->page_end ));
gnome_druid_page_edge_set_text( GNOME_DRUID_PAGE_EDGE( wiz->page_end ),
" Congratulations! \n\n You have been successfully registered " );
//gnome_druid_page_edge_set_text( GNOME_DRUID_PAGE_EDGE( wiz->page_end ),
// " Congratulations! \n\n You have been successfully registered " );
/** Events */
g_signal_connect( G_OBJECT( wiz->account_type ) , "next" , G_CALLBACK( goto_right_account ) , NULL );
@ -278,10 +329,17 @@ build_wizard( void )
g_signal_connect( G_OBJECT( wiz->sip_account ) , "next" , G_CALLBACK( goto_nat_page ), NULL );
g_signal_connect( G_OBJECT( wiz->iax_account ) , "next" , G_CALLBACK( goto_end_page ), NULL );
g_signal_connect( G_OBJECT( wiz->nat ) , "back" , G_CALLBACK( goto_sip_account_page ), NULL );
g_signal_connect( G_OBJECT( wiz->nat ) , "next" , G_CALLBACK( send_registration ) , NULL );
g_signal_connect( G_OBJECT( wiz->page_end ) , "finish" , G_CALLBACK( quit_wizard ), NULL );
gtk_widget_show_all(wiz->window);
}
void
set_account_state( account_state_t state )
{
g_print("state %i\n" , state);
current->state = state;
}

View File

@ -40,22 +40,26 @@ struct _wizard
GtkWidget *iax;
/** Page 2 - SIP account creation */
GtkWidget *sip_account;
GtkWidget *table;
GtkWidget *sip_table;
GtkWidget *label;
GtkWidget *alias;
GtkWidget *name;
GtkWidget *userpart;
GtkWidget *server;
GtkWidget *username;
GtkWidget *password;
GtkWidget *sip_alias;
GtkWidget *sip_server;
GtkWidget *sip_username;
GtkWidget *sip_password;
GtkWidget *test;
GtkWidget *state;
GtkWidget *mailbox;
/** Page 3 - IAX account creation */
GtkWidget *iax_account;
GtkWidget *iax_table;
GtkWidget *iax_alias;
GtkWidget *iax_server;
GtkWidget *iax_username;
GtkWidget *iax_password;
/** Page 4 - Nat detection */
GtkWidget *nat;
GtkWidget *enable;
GtkWidget *nat_table;
GtkWidget *addr;
/** Page 5 - Test registration */
GtkWidget *page_end;
@ -66,6 +70,8 @@ struct _wizard
* @file druid.h
* @brief Implement the configuration wizard
*/
void set_account_state( account_state_t state );
void set_account_type( GtkWidget* widget , gpointer data );
void enable_stun( GtkWidget *widget );
void goto_right_account( void );
@ -76,7 +82,8 @@ void goto_sip_account_page( void );
void quit_wizard( void );
void update_account_parameters( int type );
void build_nat_window( void );
void build_configuration_account( int type );
void build_sip_configuration_account( int type );
void build_iax_configuration_account( int type );
void build_wizard();

View File

@ -38,14 +38,10 @@
#define ACCOUNT_ENABLED "Account.enable"
/** Mail box number */
#define ACCOUNT_MAILBOX "Account.mailbox"
/** SIP parameter: full name */
#define ACCOUNT_SIP_FULL_NAME "SIP.fullName"
/** SIP parameter: host name */
#define ACCOUNT_SIP_HOST_PART "SIP.hostPart"
/** SIP parameter: user name */
#define ACCOUNT_SIP_USER_PART "SIP.userPart"
#define ACCOUNT_SIP_HOST "SIP.hostPart"
/** SIP parameter: authentification name */
#define ACCOUNT_SIP_AUTH_NAME "SIP.username"
#define ACCOUNT_SIP_USER "SIP.username"
/** SIP parameter: password */
#define ACCOUNT_SIP_PASSWORD "SIP.password"
/** SIP parameter: proxy address */
@ -54,14 +50,12 @@
#define ACCOUNT_SIP_STUN_SERVER "STUN.server"
/** SIP parameter: tells if stun is enabled or not */
#define ACCOUNT_SIP_STUN_ENABLED "STUN.enable"
/** IAX2 parameter: full name */
#define ACCOUNT_IAX_FULL_NAME "IAX.fullName"
/** IAX2 parameter: host name */
#define ACCOUNT_IAX_HOST "IAX.host"
/** IAX2 parameter: user name */
#define ACCOUNT_IAX_USER "IAX.user"
/** IAX2 parameter: password name */
#define ACCOUNT_IAX_PASS "IAX.pass"
#define ACCOUNT_IAX_PASSWORD "IAX.password"
/** Error while opening capture device */
#define ALSA_CAPTURE_DEVICE 0x0001

View File

@ -45,24 +45,18 @@ typedef std::string AccountID;
#define CONFIG_ACCOUNT_ALIAS "Account.alias"
/** Mail box number */
#define CONFIG_ACCOUNT_MAILBOX "Account.mailbox"
/** IAX paramater : full name */
#define IAX_FULL_NAME "IAX.fullName"
/** IAX paramater : host name */
#define IAX_HOST "IAX.host"
/** IAX paramater : user name */
#define IAX_USER "IAX.user"
/** IAX paramater : password */
#define IAX_PASS "IAX.pass"
/** SIP parameter : full name */
#define SIP_FULL_NAME "SIP.fullName"
/** SIP parameter : user name */
#define SIP_USER_PART "SIP.userPart"
#define IAX_PASSWORD "IAX.password"
/** SIP parameter : authorization name */
#define SIP_AUTH_NAME "SIP.username"
#define SIP_USER "SIP.username"
/** SIP parameter : password */
#define SIP_PASSWORD "SIP.password"
/** SIP parameter : host name */
#define SIP_HOST_PART "SIP.hostPart"
#define SIP_HOST "SIP.hostPart"
/** SIP parameter : proxy address */
#define SIP_PROXY "SIP.proxy"
/** SIP parameter : stun server address */

View File

@ -46,7 +46,7 @@ IAXAccount::registerVoIPLink()
// Stuff needed for IAX registration
thislink->setHost(Manager::instance().getConfigString(_accountID, IAX_HOST));
thislink->setUser(Manager::instance().getConfigString(_accountID, IAX_USER));
thislink->setPass(Manager::instance().getConfigString(_accountID, IAX_PASS));
thislink->setPass(Manager::instance().getConfigString(_accountID, IAX_PASSWORD));
}
_link->sendRegister();

View File

@ -361,7 +361,6 @@ bool
IAXVoIPLink::sendRegister()
{
bool result = false;
if (_host.empty()) {
return false;
}

View File

@ -267,9 +267,6 @@ class IAXVoIPLink : public VoIPLink
/** IAX Password */
std::string _pass;
/** IAX full name */
std::string _fullName;
/** Timestamp of when we should refresh the registration up with
* the registrar. Values can be: EPOCH timestamp, 0 if we want no registration, 1
* to force a registration. */

View File

@ -1753,23 +1753,12 @@ ManagerImpl::getAccountDetails(const AccountID& accountID)
)
);
if (accountType == "SIP") {
if( accountType == "SIP")
{
a.insert(
std::pair<std::string, std::string>(
SIP_FULL_NAME,
getConfigString(accountID, SIP_FULL_NAME)
)
);
a.insert(
std::pair<std::string, std::string>(
SIP_USER_PART,
getConfigString(accountID, SIP_USER_PART)
)
);
a.insert(
std::pair<std::string, std::string>(
SIP_AUTH_NAME,
getConfigString(accountID, SIP_AUTH_NAME)
SIP_USER,
getConfigString(accountID, SIP_USER)
)
);
a.insert(
@ -1780,8 +1769,8 @@ ManagerImpl::getAccountDetails(const AccountID& accountID)
);
a.insert(
std::pair<std::string, std::string>(
SIP_HOST_PART,
getConfigString(accountID, SIP_HOST_PART)
SIP_HOST,
getConfigString(accountID, SIP_HOST)
)
);
a.insert(
@ -1810,12 +1799,6 @@ ManagerImpl::getAccountDetails(const AccountID& accountID)
);
}
else if (accountType == "IAX") {
a.insert(
std::pair<std::string, std::string>(
IAX_FULL_NAME,
getConfigString(accountID, IAX_FULL_NAME)
)
);
a.insert(
std::pair<std::string, std::string>(
IAX_HOST,
@ -1830,8 +1813,8 @@ ManagerImpl::getAccountDetails(const AccountID& accountID)
);
a.insert(
std::pair<std::string, std::string>(
IAX_PASS,
getConfigString(accountID, IAX_PASS)
IAX_PASSWORD,
getConfigString(accountID, IAX_PASSWORD)
)
);
a.insert(
@ -1857,30 +1840,23 @@ ManagerImpl::setAccountDetails( const ::DBus::String& accountID,
std::string accountType = (*details.find(CONFIG_ACCOUNT_TYPE)).second;
setConfig(accountID, CONFIG_ACCOUNT_ALIAS, (*details.find(CONFIG_ACCOUNT_ALIAS)).second);
//setConfig(accountID, CONFIG_ACCOUNT_AUTO_REGISTER,
// (*details.find(CONFIG_ACCOUNT_AUTO_REGISTER)).second == "TRUE" ? "1": "0" );
setConfig(accountID, CONFIG_ACCOUNT_ENABLE,
(*details.find(CONFIG_ACCOUNT_ENABLE)).second == "TRUE" ? "1": "0" );
setConfig(accountID, CONFIG_ACCOUNT_ENABLE, (*details.find(CONFIG_ACCOUNT_ENABLE)).second == "TRUE" ? "1": "0" );
setConfig(accountID, CONFIG_ACCOUNT_TYPE, accountType);
if (accountType == "SIP") {
setConfig(accountID, SIP_FULL_NAME, (*details.find(SIP_FULL_NAME)).second);
setConfig(accountID, SIP_USER_PART, (*details.find(SIP_USER_PART)).second);
setConfig(accountID, SIP_AUTH_NAME, (*details.find(SIP_AUTH_NAME)).second);
setConfig(accountID, SIP_USER, (*details.find(SIP_USER)).second);
setConfig(accountID, SIP_PASSWORD, (*details.find(SIP_PASSWORD)).second);
setConfig(accountID, SIP_HOST_PART, (*details.find(SIP_HOST_PART)).second);
//setConfig(accountID, SIP_PROXY, (*details.find(SIP_PROXY)).second);
setConfig(accountID, SIP_HOST, (*details.find(SIP_HOST)).second);
setConfig(accountID, SIP_STUN_SERVER,(*details.find(SIP_STUN_SERVER)).second);
setConfig(accountID, CONFIG_ACCOUNT_MAILBOX,(*details.find(CONFIG_ACCOUNT_MAILBOX)).second);
setConfig(accountID, SIP_USE_STUN,
(*details.find(SIP_USE_STUN)).second == "TRUE" ? "1" : "0");
}
else if (accountType == "IAX") {
setConfig(accountID, IAX_FULL_NAME, (*details.find(IAX_FULL_NAME)).second);
setConfig(accountID, IAX_HOST, (*details.find(IAX_HOST)).second);
setConfig(accountID, IAX_USER, (*details.find(IAX_USER)).second);
setConfig(accountID, IAX_PASS, (*details.find(IAX_PASS)).second);
setConfig(accountID, CONFIG_ACCOUNT_MAILBOX,(*details.find(CONFIG_ACCOUNT_MAILBOX)).second);
setConfig(accountID, IAX_HOST, (*details.find(IAX_HOST)).second);
setConfig(accountID, IAX_USER, (*details.find(IAX_USER)).second);
setConfig(accountID, IAX_PASSWORD, (*details.find(IAX_PASSWORD)).second);
setConfig(accountID, CONFIG_ACCOUNT_MAILBOX, (*details.find(CONFIG_ACCOUNT_MAILBOX)).second);
} else {
_debug("Unknown account type in setAccountDetails(): %s\n", accountType.c_str());
}
@ -1922,6 +1898,7 @@ ManagerImpl::sendRegister( const ::DBus::String& accountID , bool expire )
void
ManagerImpl::addAccount(const std::map< ::DBus::String, ::DBus::String >& details)
{
/** @todo Deal with both the _accountMap and the Configuration */
std::string accountType = (*details.find(CONFIG_ACCOUNT_TYPE)).second;
Account* newAccount;
@ -1941,7 +1918,6 @@ ManagerImpl::addAccount(const std::map< ::DBus::String, ::DBus::String >& detail
return;
}
_accountMap[newAccountID] = newAccount;
setAccountDetails(accountID.str(), details);
saveConfig();

View File

@ -38,9 +38,7 @@ SIPAccount::~SIPAccount()
void
SIPAccount::registerVoIPLink()
{
_debug("SIPAccount: register account %s\n" , getAccountID().c_str());
_link->setFullName(Manager::instance().getConfigString(_accountID,SIP_FULL_NAME));
_link->setHostName(Manager::instance().getConfigString(_accountID,SIP_HOST_PART));
_link->setHostName(Manager::instance().getConfigString(_accountID,SIP_HOST));
int useStun = Manager::instance().getConfigInt(_accountID,SIP_USE_STUN);
SIPVoIPLink* thislink = dynamic_cast<SIPVoIPLink*> (_link);
@ -50,8 +48,7 @@ SIPAccount::registerVoIPLink()
_link->init();
// Stuff needed for SIP registration.
thislink->setProxy (Manager::instance().getConfigString(_accountID,SIP_PROXY));
thislink->setUserPart(Manager::instance().getConfigString(_accountID,SIP_USER_PART));
thislink->setAuthName(Manager::instance().getConfigString(_accountID,SIP_AUTH_NAME));
thislink->setAuthName(Manager::instance().getConfigString(_accountID,SIP_USER));
thislink->setPassword(Manager::instance().getConfigString(_accountID,SIP_PASSWORD));
_link->sendRegister();
}

View File

@ -147,7 +147,7 @@ SIPVoIPLink::init()
std::string tmp = std::string(PROGNAME_GLOBAL) + "/" + std::string(SFLPHONED_VERSION);
eXosip_set_user_agent(tmp.data());
_debug(" SIP Init: starting loop thread (SIP events)\n");
_debug(" SIP Init: starting loop thread (SIP events)\n" );
_evThread->start();
}
@ -452,14 +452,13 @@ SIPVoIPLink::sendRegister()
return false;
}
if (_userpart.empty()) {
if (_authname.empty()) {
return false;
}
std::string proxy = "sip:" + _proxy;
hostname = "sip:" + hostname;
std::string from = SIPFromHeader(_userpart, getHostName());
std::string from = SIPFromHeader(_authname, getHostName());
osip_message_t *reg = NULL;
eXosip_lock();
@ -515,7 +514,7 @@ SIPVoIPLink::sendSIPAuthentification()
{
std::string login = _authname;
if (login.empty()) {
login = _userpart;
return false;
}
if (login.empty()) {
/** @todo Ajouter ici un call à setRegistrationState(Error, "Fill balh") ? */
@ -963,7 +962,7 @@ SIPVoIPLink::subscribePresenceForContact(Contact* contact)
std::ostringstream from;
// Build URL of sender
from << "sip:" << _userpart.data() << "@" << getHostName().data();
from << "sip:" << _authname.data() << "@" << getHostName().data();
// Subscribe for changes on server but also polls at every 5000 interval
i = eXosip_subscribe_build_initial_request(&subscription,
@ -996,7 +995,7 @@ SIPVoIPLink::publishPresenceStatus(std::string status)
std::string note;
// Build URL of sender
url << "sip:" << _userpart.data() << "@" << getHostName().data();
url << "sip:" << _authname.data() << "@" << getHostName().data();
// TODO
// Call function to convert status in basic and note
@ -1152,7 +1151,7 @@ SIPVoIPLink::getSipFrom() {
if ( host.empty() ) {
host = _localIPAddress;
}
return SIPFromHeader(_userpart, host);
return SIPFromHeader(_authname, host);
}
std::string

View File

@ -183,12 +183,6 @@ class SIPVoIPLink : public VoIPLink
*/
void setProxy(const std::string& proxy) { _proxy = proxy; }
/**
* Set the user part
* @param userpart User part
*/
void setUserPart(const std::string& userpart) { _userpart = userpart; }
/**
* Set the authentification name
* @param authname The authentification name