# HG changeset patch # User Sadrul Habib Chowdhury # Date 1210003262 0 # Node ID 750813c2db46874d1bad6de7ca686221b901d4e0 # Parent f09acca600663b3087293ef1e5c9c51bf0aaceb1 The required fields are not really required if the action is cancelled. diff -r f09acca60066 -r 750813c2db46 finch/gntrequest.c --- a/finch/gntrequest.c Mon May 05 14:56:36 2008 +0000 +++ b/finch/gntrequest.c Mon May 05 16:01:02 2008 +0000 @@ -98,6 +98,8 @@ * cb: the callback * data: data for the callback * (text, primary-callback) pairs, ended by a NULL + * + * The cancellation callback should be the last callback sent. */ static GntWidget * setup_button_box(GntWidget *win, gpointer userdata, gpointer cb, gpointer data, ...) @@ -122,6 +124,8 @@ g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data); } + g_object_set_data(G_OBJECT(button), "cancellation-function", GINT_TO_POINTER(TRUE)); + va_end(list); return box; } @@ -300,7 +304,7 @@ { PurpleRequestFieldGroup *group = list->data; GList *fields = purple_request_field_group_get_fields(group); - + for (; fields ; fields = fields->next) { PurpleRequestField *field = fields->data; @@ -369,7 +373,8 @@ purple_notify_close_with_handle(button); - if (!purple_request_fields_all_required_filled(fields)) { + if (!g_object_get_data(G_OBJECT(button), "cancellation-function") && + !purple_request_fields_all_required_filled(fields)) { purple_notify_error(button, _("Error"), _("You must fill all the required fields."), _("The required fields are underlined.")); @@ -653,7 +658,7 @@ } g_object_set_data(G_OBJECT(window), "fields", allfields); - + return window; }