diff --git a/gnome/src/config/accountconfigdialog.c b/gnome/src/config/accountconfigdialog.c index 7e2df62129929c5377fd4c3aac367247595d9d68..0b641c9679fbacbc32f681de37beba6ed70c3cf9 100644 --- a/gnome/src/config/accountconfigdialog.c +++ b/gnome/src/config/accountconfigdialog.c @@ -221,7 +221,7 @@ create_auto_answer_checkbox(account_t *account) } static GtkWidget* -create_basic_tab(account_t *account) +create_basic_tab(account_t *account, gboolean is_new) { g_assert(account); gchar *password = NULL; @@ -237,17 +237,7 @@ create_basic_tab(account_t *account) GtkWidget *frame = gnome_main_section_new(_("Account Parameters")); gtk_widget_show(frame); - GtkWidget *grid = NULL; - - if (account_is_SIP(account)) - grid = gtk_grid_new(); - else if (account_is_IAX(account)) - grid = gtk_grid_new(); - else { - g_warning("Unknown account type"); - return NULL; - } - + GtkWidget *grid = gtk_grid_new(); gtk_grid_set_row_spacing(GTK_GRID(grid), 10); gtk_grid_set_column_spacing(GTK_GRID(grid), 10); gtk_widget_show(grid); @@ -285,6 +275,10 @@ create_basic_tab(account_t *account) gtk_combo_box_set_active(GTK_COMBO_BOX(protocol_combo), 2); } + /* Can't change account type after creation */ + if (!is_new) + gtk_widget_set_sensitive(protocol_combo, FALSE); + gtk_grid_attach(GTK_GRID(grid), protocol_combo, 1, row, 1, 1); /* Link signal 'changed' */ @@ -1328,7 +1322,7 @@ void update_account_from_dialog(GtkWidget *dialog, account_t *account) } GtkWidget * -show_account_window(account_t *account, SFLPhoneClient *client) +show_account_window(account_t *account, SFLPhoneClient *client, gboolean is_new) { // First we reset reset(); @@ -1353,7 +1347,7 @@ show_account_window(account_t *account, SFLPhoneClient *client) // We do not need the global settings for the IP2IP account if (!IS_IP2IP) { /* General Settings */ - GtkWidget *basic_tab = create_basic_tab(account); + GtkWidget *basic_tab = create_basic_tab(account, is_new); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), basic_tab, gtk_label_new(_("Basic"))); gtk_notebook_page_num(GTK_NOTEBOOK(notebook), basic_tab); } diff --git a/gnome/src/config/accountconfigdialog.h b/gnome/src/config/accountconfigdialog.h index bbe5d2233741ac5bf4e787af226de92ccd9e3cfa..79dbced498896369be13e007b5b432e09cac48c8 100644 --- a/gnome/src/config/accountconfigdialog.h +++ b/gnome/src/config/accountconfigdialog.h @@ -40,10 +40,12 @@ /** * Display the main account widget * @param a The account you want to display + * @param client Our client instance + * @param is_new TRUE if this account is being added * @return The dialog with the pertinent account information */ GtkWidget * -show_account_window(account_t *a, SFLPhoneClient *client); +show_account_window(account_t *a, SFLPhoneClient *client, gboolean is_new); /* * @param dialog The dialog the account will be update from diff --git a/gnome/src/config/accountlistconfigdialog.c b/gnome/src/config/accountlistconfigdialog.c index 182ac585babe60633693bf5adcf7b403fb71e09a..35174aa3bc76d7215c7a0a4ff90cb2e9068c10c0 100644 --- a/gnome/src/config/accountlistconfigdialog.c +++ b/gnome/src/config/accountlistconfigdialog.c @@ -117,10 +117,10 @@ static void delete_account_cb(G_GNUC_UNUSED GtkButton *button, gpointer data) static void account_store_fill(); static void -run_account_dialog(const gchar *selected_accountID, SFLPhoneClient *client) +run_account_dialog(const gchar *selected_accountID, SFLPhoneClient *client, gboolean is_new) { account_t *account = account_list_get_by_id(selected_accountID); - GtkWidget *dialog = show_account_window(account, client); + GtkWidget *dialog = show_account_window(account, client, is_new); update_account_from_dialog(dialog, account); account_store_fill(); } @@ -132,7 +132,7 @@ static void row_activated_cb(GtkTreeView *view, { gchar *selected_accountID = get_selected_accountID(view); g_return_if_fail(selected_accountID != NULL); - run_account_dialog(selected_accountID, client); + run_account_dialog(selected_accountID, client, FALSE); g_free(selected_accountID); } @@ -145,7 +145,7 @@ static void edit_account_cb(G_GNUC_UNUSED GtkButton *button, EditData *data) { gchar *selected_accountID = get_selected_accountID(GTK_TREE_VIEW(data->view)); g_return_if_fail(selected_accountID != NULL); - run_account_dialog(selected_accountID, data->client); + run_account_dialog(selected_accountID, data->client, FALSE); g_free(selected_accountID); } @@ -199,7 +199,7 @@ static void add_account_cb(SFLPhoneClient *client) { account_t *new_account = create_default_account(); account_list_add(new_account); - run_account_dialog(new_account->accountID, client); + run_account_dialog(new_account->accountID, client, TRUE); } /**