pidgin: 79640e5d: The required fields are not really requi...

sadrul at pidgin.im sadrul at pidgin.im
Mon May 5 12:06:00 EDT 2008


-----------------------------------------------------------------
Revision: 79640e5d8ef63294f565d44aa56de5f46611c506
Ancestor: d7d27a0074887bcfe3ed4e95984dcad10133315a
Author: sadrul at pidgin.im
Date: 2008-05-05T16:01:02
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/79640e5d8ef63294f565d44aa56de5f46611c506

Modified files:
        finch/gntrequest.c

ChangeLog: 

The required fields are not really required if the action is cancelled.

-------------- next part --------------
============================================================
--- finch/gntrequest.c	40bf5bd865115cd25d78b949c40ceb9a7d5ac26b
+++ finch/gntrequest.c	c710ede1e651c8088bc62d4cdd44f4b8279fda95
@@ -98,6 +98,8 @@ action_performed(GntWidget *button, gpoi
  * 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 @@ setup_button_box(GntWidget *win, gpointe
 		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 @@ request_fields_cb(GntWidget *button, Pur
 	{
 		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 @@ request_fields_cb(GntWidget *button, Pur
 
 	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 @@ finch_request_fields(const char *title, 
 	}
 
 	g_object_set_data(G_OBJECT(window), "fields", allfields);
-	
+
 	return window;
 }
 


More information about the Commits mailing list