Commit e7c6cb8a authored by Simon Morlat's avatar Simon Morlat
Browse files

fix problem when creating new account on gtk UI. The proxy fields were not...

fix problem when creating new account on gtk UI. The proxy fields were not initialized with the proxy config default values.
parent 3e39cc57
......@@ -100,7 +100,7 @@ static void linphone_proxy_config_init(LinphoneCore* lc, LinphoneProxyConfig *ob
const char *contact_uri_params = lc ? lp_config_get_default_string(lc->config, "proxy", "contact_uri_parameters", NULL) : NULL;
obj->expires = lc ? lp_config_get_default_int(lc->config, "proxy", "reg_expires", 3600) : 3600;
obj->reg_sendregister = lc ? lp_config_get_default_int(lc->config, "proxy", "reg_sendregister", 0) : 0;
obj->reg_sendregister = lc ? lp_config_get_default_int(lc->config, "proxy", "reg_sendregister", 1) : 1;
obj->dial_prefix = dial_prefix ? ms_strdup(dial_prefix) : NULL;
obj->dial_escape_plus = lc ? lp_config_get_default_int(lc->config, "proxy", "dial_escape_plus", 0) : 0;
obj->privacy = lc ? lp_config_get_default_int(lc->config, "proxy", "privacy", LinphonePrivacyDefault) : LinphonePrivacyDefault;
......
......@@ -830,8 +830,11 @@ void linphone_gtk_show_sip_accounts(GtkWidget *w){
static void linphone_gtk_proxy_closed(GtkWidget *w){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)g_object_get_data(G_OBJECT(w),"config");
gboolean was_editing=! GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"is_new"));
if (cfg){
linphone_proxy_config_done(cfg);
if (was_editing){
linphone_proxy_config_done(cfg);
}else linphone_proxy_config_destroy(cfg);
}
}
......@@ -909,7 +912,15 @@ void linphone_gtk_proxy_address_changed(GtkEditable *editable){
void linphone_gtk_show_proxy_config(GtkWidget *pb, LinphoneProxyConfig *cfg){
GtkWidget *w=linphone_gtk_create_window("sip_account");
const char *tmp;
if (cfg){
gboolean is_new=FALSE;
if (!cfg) {
cfg=linphone_core_create_proxy_config(linphone_gtk_get_core());
is_new=TRUE;
g_object_set_data(G_OBJECT(w),"is_new",GINT_TO_POINTER(TRUE));
}
if (!is_new){
linphone_proxy_config_edit(cfg);
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"identity")),
linphone_proxy_config_get_identity(cfg));
......@@ -918,17 +929,19 @@ void linphone_gtk_show_proxy_config(GtkWidget *pb, LinphoneProxyConfig *cfg){
if (tmp) gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"route")),tmp);
tmp=linphone_proxy_config_get_contact_parameters(cfg);
if (tmp) gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"params")),tmp);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(w,"regperiod")),
linphone_proxy_config_get_expires(cfg));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"register")),
linphone_proxy_config_register_enabled(cfg));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"publish")),
linphone_proxy_config_publish_enabled(cfg));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"avpf")),
linphone_proxy_config_avpf_enabled(cfg));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(w,"avpf_rr_interval")),
linphone_proxy_config_get_avpf_rr_interval(cfg));
}
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(w,"regperiod")),
linphone_proxy_config_get_expires(cfg));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"register")),
linphone_proxy_config_register_enabled(cfg));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"publish")),
linphone_proxy_config_publish_enabled(cfg));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"avpf")),
linphone_proxy_config_avpf_enabled(cfg));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(w,"avpf_rr_interval")),
linphone_proxy_config_get_avpf_rr_interval(cfg));
g_object_set_data(G_OBJECT(w),"config",(gpointer)cfg);
g_object_set_data(G_OBJECT(w),"parameters",(gpointer)pb);
g_object_weak_ref(G_OBJECT(w),(GWeakNotify)linphone_gtk_proxy_closed,w);
......@@ -946,12 +959,8 @@ void linphone_gtk_proxy_ok(GtkButton *button){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)g_object_get_data(G_OBJECT(w),"config");
int index=gtk_combo_box_get_active(GTK_COMBO_BOX(linphone_gtk_get_widget(w,"transport")));
LinphoneTransportType tport=(LinphoneTransportType)index;
gboolean was_editing=TRUE;
gboolean was_editing=! GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"is_new"));
if (!cfg){
was_editing=FALSE;
cfg=linphone_proxy_config_new();
}
linphone_proxy_config_set_identity(cfg,
gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(w,"identity"))));
if (linphone_proxy_config_set_server_addr(cfg,
......
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