func (f *registrationForm) accepted() error { conf, err := config.NewAccount() if err != nil { return err } //Find the fields we need to copy from the form to the account for _, field := range f.fields { ff := field.field.(*data.TextFormField) w := field.widget.(gtki.Entry) ff.Result, _ = w.GetText() switch ff.Label { case "User", "Username": conf.Account = ff.Result + "@" + f.server case "Password": conf.Password = ff.Result default: log.Println("Field", ff.Label) } } f.conf = conf return nil }
func (u *gtkUI) showAddAccountWindow() { c, _ := config.NewAccount() u.accountDialog(nil, c, func() { u.addAndSaveAccountConfig(c) u.notify(i18n.Local("Account added"), fmt.Sprintf(i18n.Local("The account %s was added successfully."), c.Account)) }) }
func (u *gtkUI) showAddAccountWindow() error { c, err := config.NewAccount() if err != nil { return err } u.accountDialog(nil, c, func() { u.addAndSaveAccountConfig(c) u.notify(i18n.Local("Account added"), fmt.Sprintf(i18n.Local("The account %s was added successfully."), c.Account)) }) return nil }