Mercurial > pidgin.yaz
changeset 22765:4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
labels for the required fields.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Tue, 29 Apr 2008 19:13:55 +0000 |
parents | a67d70664898 |
children | 946f1bb22adb |
files | finch/gntrequest.c |
diffstat | 1 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/gntrequest.c Tue Apr 29 19:01:25 2008 +0000 +++ b/finch/gntrequest.c Tue Apr 29 19:13:55 2008 +0000 @@ -295,8 +295,7 @@ * updating the fields at the end like here, it updates the appropriate field * instantly whenever a change is made. That allows it to make sure the * 'required' fields are entered before the user can hit OK. It's not the case - * here, althought it can be done. I am not honouring the 'required' fields - * for the moment. */ + * here, althought it can be done. */ for (list = purple_request_fields_get_groups(fields); list; list = list->next) { PurpleRequestFieldGroup *group = list->data; @@ -368,6 +367,15 @@ } } + purple_notify_close_with_handle(button); + + if (!purple_request_fields_all_required_filled(fields)) { + purple_notify_error(button, _("Error"), + _("You must fill all the required fields."), + _("The required fields are underlined.")); + return; + } + if (callback) callback(data, fields); @@ -587,7 +595,11 @@ if (type != PURPLE_REQUEST_FIELD_BOOLEAN && label) { - GntWidget *l = gnt_label_new(label); + GntWidget *l; + if (purple_request_field_is_required(field)) + l = gnt_label_new_with_format(label, GNT_TEXT_FLAG_UNDERLINE); + else + l = gnt_label_new(label); gnt_widget_set_size(l, 0, 1); gnt_box_add_widget(GNT_BOX(hbox), l); }