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

Fix bug #102

The sip section in the preferences window is set insensitive if no sip accounts are configured
parent 8151ba12
Branches
Tags
No related merge requests found
......@@ -230,3 +230,37 @@ gchar* account_list_get_current_id( void ){
else
return __CURRENT_ACCOUNT_ID;
}
int account_list_get_sip_account_number( void ){
int n;
guint size, i;
account_t *current;
size = account_list_get_size();
n = 0;
for( i=0; i<size ;i++ ){
current = account_list_get_nth( i );
if( strcmp(g_hash_table_lookup(current->properties, ACCOUNT_TYPE), "SIP" ) == 0 )
n++;
}
return n;
}
int account_list_get_iax_account_number( void ){
int n;
guint size, i;
account_t *current;
size = account_list_get_size();
n = 0;
for( i=0; i<size ;i++ ){
current = account_list_get_nth( i );
if( strcmp(g_hash_table_lookup(current->properties, ACCOUNT_TYPE), "IAX" ) == 0 )
n++;
}
return n;
}
......@@ -167,4 +167,16 @@ void account_list_move_down( guint index );
*/
gchar* account_list_get_current_id( void );
/**
* Returns the number of SIP accounts that have been configured
*/
int account_list_get_sip_account_number( void );
/**
* Returns the number of IAX accounts that have been configured
*/
int account_list_get_iax_account_number( void );
#endif
......@@ -314,7 +314,7 @@ set_pulse_app_volume_control( void )
dbus_set_pulse_app_volume_control();
}
static void update_port( GtkSpinButton *button, void *ptr )
static void update_port( GtkSpinButton *button UNUSED, void *ptr )
{
dbus_set_sip_port(gtk_spin_button_get_value_as_int((GtkSpinButton *)(ptr)));
}
......@@ -439,6 +439,10 @@ create_accounts_tab()
GtkWidget*
create_general_settings ()
{
int curPort;
int n;
GtkWidget *ret;
GtkWidget *notifFrame;
......@@ -542,14 +546,18 @@ create_general_settings ()
gtk_box_pack_start( GTK_BOX(vbox) , widg , TRUE , TRUE , 1);
g_signal_connect(G_OBJECT( widg ) , "clicked" , G_CALLBACK( set_pulse_app_volume_control ) , NULL);
n = account_list_get_sip_account_number();
printf("sip account number = %i\n", n);
/** SIP port information */
int curPort = dbus_get_sip_port();
curPort = dbus_get_sip_port();
if(curPort <= 0 || curPort > 65535)
curPort = 5060;
frame = gtk_frame_new( _("SIP Port"));
gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);
gtk_widget_show( frame );
gtk_widget_set_sensitive( GTK_WIDGET(frame), (n==0)?FALSE:TRUE );
hbox = gtk_hbox_new(FALSE, 10);
gtk_widget_show( hbox );
......@@ -557,6 +565,7 @@ create_general_settings ()
GtkWidget *applyButton = gtk_button_new_with_label(_("Apply"));
gtk_widget_set_size_request(applyButton, 60, 35);
//gtk_widget_set_sensitive( GTK_WIDGET(applyButton), (n==0)?FALSE:TRUE );
label = gtk_label_new(_("Port:"));
......
......@@ -2408,8 +2408,11 @@ ManagerImpl::getSipPort()
if( _userAgent )
return _userAgent->getSipPort();
else
{
// It means that no SIP accounts are configured, so return a default value
return 0;
}
}
void
ManagerImpl::setSipPort(int portNum)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment