Skip to content
Snippets Groups Projects
Commit 7379d58b authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #10725: assistant: cleanup

parent 200f061f
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,7 @@
struct _wizard *wiz;
static int account_type;
static int use_sflphone_org = 1;
static gboolean use_sflphone_org = TRUE;
static account_t* current;
static char message[1024];
/**
......@@ -103,11 +103,9 @@ void getMessageSummary(const gchar * alias, const gchar * server, const gchar *
void set_sflphone_org(GtkWidget* widget, gpointer data UNUSED)
{
use_sflphone_org = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) ?1:0) ;
use_sflphone_org = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
/**
* Callback when the close button of the dialog is clicked
* Action : close the assistant widget and get back to sflphone main window
......@@ -220,7 +218,7 @@ void enable_stun(GtkWidget* widget)
void build_wizard(void)
{
use_sflphone_org = 1;
use_sflphone_org = TRUE;
if (wiz)
return;
......@@ -260,10 +258,8 @@ void build_wizard(void)
GtkWidget* build_intro()
{
GtkWidget *label;
wiz->intro = create_vbox(GTK_ASSISTANT_PAGE_INTRO, "SFLphone GNOME client", _("Welcome to the Account creation wizard of SFLphone!"));
label = gtk_label_new(_("This installation wizard will help you configure an account.")) ;
GtkWidget *label = gtk_label_new(_("This installation wizard will help you configure an account."));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_widget_set_size_request(GTK_WIDGET(label), 380, -1);
......@@ -275,14 +271,11 @@ GtkWidget* build_intro()
GtkWidget* build_select_account()
{
GtkWidget* sip;
GtkWidget* iax;
wiz->protocols = create_vbox(GTK_ASSISTANT_PAGE_CONTENT, _("VoIP Protocols"), _("Select an account type"));
sip = gtk_radio_button_new_with_label(NULL, _("SIP (Session Initiation Protocol)"));
GtkWidget *sip = gtk_radio_button_new_with_label(NULL, _("SIP (Session Initiation Protocol)"));
gtk_box_pack_start(GTK_BOX(wiz->protocols), sip, TRUE, TRUE, 0);
iax = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sip), _("IAX2 (InterAsterix Exchange)"));
GtkWidget *iax = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sip), _("IAX2 (InterAsterix Exchange)"));
gtk_box_pack_start(GTK_BOX(wiz->protocols), iax, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(sip), "clicked", G_CALLBACK(set_account_type), NULL);
......@@ -294,14 +287,11 @@ GtkWidget* build_select_account()
GtkWidget* build_sfl_or_account()
{
GtkWidget* sfl;
GtkWidget* cus;
wiz->sflphone_org = create_vbox(GTK_ASSISTANT_PAGE_CONTENT, _("Account"), _("Please select one of the following options"));
sfl = gtk_radio_button_new_with_label(NULL, _("Create a free SIP/IAX2 account on sflphone.org \n(For testing purpose only)"));
GtkWidget *sfl = gtk_radio_button_new_with_label(NULL, _("Create a free SIP/IAX2 account on sflphone.org \n(For testing purpose only)"));
gtk_box_pack_start(GTK_BOX(wiz->sflphone_org), sfl, TRUE, TRUE, 0);
cus = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sfl), _("Register an existing SIP or IAX2 account"));
GtkWidget *cus = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sfl), _("Register an existing SIP or IAX2 account"));
gtk_box_pack_start(GTK_BOX(wiz->sflphone_org), cus, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(sfl), "clicked", G_CALLBACK(set_sflphone_org), NULL);
......@@ -519,7 +509,6 @@ GtkWidget* build_summary()
gtk_label_set_selectable(GTK_LABEL(wiz->label_summary), TRUE);
gtk_misc_set_alignment(GTK_MISC(wiz->label_summary), 0, 0);
gtk_label_set_line_wrap(GTK_LABEL(wiz->label_summary), TRUE);
//gtk_widget_set_size_request(GTK_WIDGET(wiz->label_summary), 380, -1);
gtk_box_pack_start(GTK_BOX(wiz->summary), wiz->label_summary, FALSE, TRUE, 0);
return wiz->summary;
......@@ -549,7 +538,7 @@ void set_sip_infos_sentivite(gboolean b)
void prefill_sip(void)
{
if (use_sflphone_org == 1) {
if (use_sflphone_org) {
char alias[300];
char *email;
email = (char *) gtk_entry_get_text(GTK_ENTRY(wiz->mailbox));
......@@ -589,9 +578,9 @@ static gint forward_page_func(gint current_page , gpointer data UNUSED)
break;
case PAGE_SFL:
if (use_sflphone_org) {
if (use_sflphone_org)
next_page = PAGE_EMAIL;
} else
else
next_page = PAGE_TYPE;
break;
......@@ -600,8 +589,9 @@ static gint forward_page_func(gint current_page , gpointer data UNUSED)
if (account_type == _SIP) {
set_sip_infos_sentivite(TRUE);
next_page = PAGE_SIP;
} else
} else {
next_page = PAGE_IAX;
}
break;
case PAGE_SIP:
......@@ -629,18 +619,13 @@ static gint forward_page_func(gint current_page , gpointer data UNUSED)
static GtkWidget* create_vbox(GtkAssistantPageType type, const gchar *title, const gchar *section)
{
GtkWidget *vbox;
GtkWidget *label;
gchar *str;
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 24);
gtk_assistant_append_page(GTK_ASSISTANT(wiz->assistant), vbox);
gtk_assistant_set_page_type(GTK_ASSISTANT(wiz->assistant), vbox, type);
str = g_strdup_printf(" %s", title);
gchar *str = g_strdup_printf(" %s", title);
gtk_assistant_set_page_title(GTK_ASSISTANT(wiz->assistant), vbox, str);
g_free(str);
gtk_assistant_set_page_complete(GTK_ASSISTANT(wiz->assistant), vbox, TRUE);
......@@ -654,7 +639,7 @@ static GtkWidget* create_vbox(GtkAssistantPageType type, const gchar *title, con
#endif
if (section) {
label = gtk_label_new(NULL);
GtkWidget *label = gtk_label_new(NULL);
str = g_strdup_printf("<b>%s</b>\n", section);
gtk_label_set_markup(GTK_LABEL(label), str);
g_free(str);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment