An error occurred while loading the file. Please try again.
-
Johann Koenig authored
Better fix for #326. ICC happens to support the inline magic Change-Id: Ic367eea608c88d89475cb7b05d73500d2a1bc42b
79327be6
setupwizard.c 28.34 KiB
/*
linphone, gtk-glade interface.
Copyright (C) 2008 Simon MORLAT (simon.morlat@linphone.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"
#include <glib.h>
#include <glib/gprintf.h>
static LinphoneAccountCreator *linphone_gtk_assistant_get_creator(GtkWidget*w);
static const int PASSWORD_MIN_SIZE = 6;
static const int LOGIN_MIN_SIZE = 4;
static GtkWidget *the_assistant=NULL;
static GdkPixbuf *ok;
static GdkPixbuf *notok;
static GtkWidget *create_intro(){
GtkWidget *vbox=gtk_vbox_new(FALSE,2);
GtkWidget *label=gtk_label_new(_("Welcome !\nThis assistant will help you to use a SIP account for your calls."));
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 2);
g_object_set_data(G_OBJECT(vbox),"label",label);
gtk_widget_show_all(vbox);
return vbox;
}
static GtkWidget *create_setup_signin_choice(){
GtkWidget *vbox=gtk_vbox_new(FALSE,2);
GtkWidget *t1=gtk_radio_button_new_with_label(NULL,_("Create an account on linphone.org"));
GtkWidget *t2=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(t1),_("I have already a linphone.org account and I just want to use it"));
GtkWidget *t3=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(t1),_("I have already a sip account and I just want to use it"));
GtkWidget *t4=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(t1),_("I want to specify a remote configuration URI"));
gtk_box_pack_start (GTK_BOX (vbox), t1, TRUE, TRUE, 2);
gtk_box_pack_start (GTK_BOX (vbox), t2, TRUE, TRUE, 2);
gtk_box_pack_start (GTK_BOX (vbox), t3, TRUE, TRUE, 2);
gtk_box_pack_start (GTK_BOX (vbox), t4, TRUE, TRUE, 2);
gtk_widget_show_all(vbox);
g_object_set_data(G_OBJECT(vbox),"create_account",t1);
g_object_set_data(G_OBJECT(vbox),"setup_linphone_account",t2);
g_object_set_data(G_OBJECT(vbox),"setup_account",t3);
g_object_set_data(G_OBJECT(vbox),"config-uri",t4);
return vbox;
}
static int all_account_information_entered(GtkWidget *w) {
GtkEntry* username = GTK_ENTRY(g_object_get_data(G_OBJECT(w),"username"));
GtkEntry* domain = GTK_ENTRY(g_object_get_data(G_OBJECT(w),"domain"));
if (gtk_entry_get_text_length(username) > 0 &&
gtk_entry_get_text_length(domain) > 0 &&
g_regex_match_simple("^[a-zA-Z0-9]+[a-zA-Z0-9.\\-_]{2,}$", gtk_entry_get_text(username), 0, 0) &&
g_regex_match_simple("^(sip:)?([a-zA-Z0-9]+([\\.-][a-zA-Z0-9]+)*)$", gtk_entry_get_text(domain), 0, 0)) {
return 1;
}
return 0;