pidgin: 4631c043: Make sure the required fields are all en...

sadrul at pidgin.im sadrul at pidgin.im
Tue Apr 29 15:15:49 EDT 2008


-----------------------------------------------------------------
Revision: 4631c04318880d3e20521e0177520e64546dd995
Ancestor: 8c632af6a9e6e130a68a463ad11364f987d50cf1
Author: sadrul at pidgin.im
Date: 2008-04-29T19:13:55
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4631c04318880d3e20521e0177520e64546dd995

Modified files:
        finch/gntrequest.c

ChangeLog: 

Make sure the required fields are all entered correctly. Underline the
labels for the required fields.

-------------- next part --------------
============================================================
--- finch/gntrequest.c	3785304517b813f3587c989c2b411ba6d9c3d8aa
+++ finch/gntrequest.c	40bf5bd865115cd25d78b949c40ceb9a7d5ac26b
@@ -295,8 +295,7 @@ request_fields_cb(GntWidget *button, Pur
 	 * 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 @@ request_fields_cb(GntWidget *button, Pur
 		}
 	}
 
+	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 @@ finch_request_fields(const char *title, 
 
 			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);
 			}


More information about the Commits mailing list