# HG changeset patch # User Sadrul Habib Chowdhury # Date 1209496435 0 # Node ID 4457e6a99d130abe28a4c37f7a0782fb0d25cd8c # Parent a67d7066489849a13e0a68a284a1be16104090e1 Make sure the required fields are all entered correctly. Underline the labels for the required fields. diff -r a67d70664898 -r 4457e6a99d13 finch/gntrequest.c --- 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); }