comparison finch/gntrequest.c @ 22789: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 1f256f63c52c
children 750813c2db46
comparison
equal deleted inserted replaced
22788:a67d70664898 22789:4457e6a99d13
293 293
294 /* Update the data of the fields. Pidgin does this differently. Instead of 294 /* Update the data of the fields. Pidgin does this differently. Instead of
295 * updating the fields at the end like here, it updates the appropriate field 295 * updating the fields at the end like here, it updates the appropriate field
296 * instantly whenever a change is made. That allows it to make sure the 296 * instantly whenever a change is made. That allows it to make sure the
297 * 'required' fields are entered before the user can hit OK. It's not the case 297 * 'required' fields are entered before the user can hit OK. It's not the case
298 * here, althought it can be done. I am not honouring the 'required' fields 298 * here, althought it can be done. */
299 * for the moment. */
300 for (list = purple_request_fields_get_groups(fields); list; list = list->next) 299 for (list = purple_request_fields_get_groups(fields); list; list = list->next)
301 { 300 {
302 PurpleRequestFieldGroup *group = list->data; 301 PurpleRequestFieldGroup *group = list->data;
303 GList *fields = purple_request_field_group_get_fields(group); 302 GList *fields = purple_request_field_group_get_fields(group);
304 303
364 GntWidget *combo = FINCH_GET_DATA(field); 363 GntWidget *combo = FINCH_GET_DATA(field);
365 PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); 364 PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo));
366 purple_request_field_account_set_value(field, acc); 365 purple_request_field_account_set_value(field, acc);
367 } 366 }
368 } 367 }
368 }
369
370 purple_notify_close_with_handle(button);
371
372 if (!purple_request_fields_all_required_filled(fields)) {
373 purple_notify_error(button, _("Error"),
374 _("You must fill all the required fields."),
375 _("The required fields are underlined."));
376 return;
369 } 377 }
370 378
371 if (callback) 379 if (callback)
372 callback(data, fields); 380 callback(data, fields);
373 381
585 hbox = gnt_hbox_new(TRUE); /* hrm */ 593 hbox = gnt_hbox_new(TRUE); /* hrm */
586 gnt_box_add_widget(GNT_BOX(box), hbox); 594 gnt_box_add_widget(GNT_BOX(box), hbox);
587 595
588 if (type != PURPLE_REQUEST_FIELD_BOOLEAN && label) 596 if (type != PURPLE_REQUEST_FIELD_BOOLEAN && label)
589 { 597 {
590 GntWidget *l = gnt_label_new(label); 598 GntWidget *l;
599 if (purple_request_field_is_required(field))
600 l = gnt_label_new_with_format(label, GNT_TEXT_FLAG_UNDERLINE);
601 else
602 l = gnt_label_new(label);
591 gnt_widget_set_size(l, 0, 1); 603 gnt_widget_set_size(l, 0, 1);
592 gnt_box_add_widget(GNT_BOX(hbox), l); 604 gnt_box_add_widget(GNT_BOX(hbox), l);
593 } 605 }
594 606
595 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) 607 if (type == PURPLE_REQUEST_FIELD_BOOLEAN)