Mercurial > pidgin.yaz
comparison finch/gntrequest.c @ 23113:8c3444f04709
propagate from branch 'im.pidgin.pidgin' (head d7144f5dbbde09137aff1ceadfd419e25303bf7d)
to branch 'im.pidgin.pidgin.next.minor' (head b6f1c6f279a87ac4b59426eea116c349eb31fe8c)
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Wed, 07 May 2008 12:14:28 +0000 |
parents | 5c9d9df219af |
children | 5d681e194fb3 ff29208e03ef |
comparison
equal
deleted
inserted
replaced
23112:bb41bdce8981 | 23113:8c3444f04709 |
---|---|
96 * window: this is the window | 96 * window: this is the window |
97 * userdata: the userdata to pass to the primary callbacks | 97 * userdata: the userdata to pass to the primary callbacks |
98 * cb: the callback | 98 * cb: the callback |
99 * data: data for the callback | 99 * data: data for the callback |
100 * (text, primary-callback) pairs, ended by a NULL | 100 * (text, primary-callback) pairs, ended by a NULL |
101 * | |
102 * The cancellation callback should be the last callback sent. | |
101 */ | 103 */ |
102 static GntWidget * | 104 static GntWidget * |
103 setup_button_box(GntWidget *win, gpointer userdata, gpointer cb, gpointer data, ...) | 105 setup_button_box(GntWidget *win, gpointer userdata, gpointer cb, gpointer data, ...) |
104 { | 106 { |
105 GntWidget *box, *button; | 107 GntWidget *box; |
108 GntWidget *button = NULL; | |
106 va_list list; | 109 va_list list; |
107 const char *text; | 110 const char *text; |
108 gpointer callback; | 111 gpointer callback; |
109 | 112 |
110 box = gnt_hbox_new(FALSE); | 113 box = gnt_hbox_new(FALSE); |
120 g_object_set_data(G_OBJECT(button), "activate-userdata", userdata); | 123 g_object_set_data(G_OBJECT(button), "activate-userdata", userdata); |
121 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(action_performed), win); | 124 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(action_performed), win); |
122 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data); | 125 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data); |
123 } | 126 } |
124 | 127 |
128 if (button) | |
129 g_object_set_data(G_OBJECT(button), "cancellation-function", GINT_TO_POINTER(TRUE)); | |
130 | |
125 va_end(list); | 131 va_end(list); |
126 return box; | 132 return box; |
127 } | 133 } |
128 | 134 |
129 static void | 135 static void |
298 * here, althought it can be done. */ | 304 * here, althought it can be done. */ |
299 for (list = purple_request_fields_get_groups(fields); list; list = list->next) | 305 for (list = purple_request_fields_get_groups(fields); list; list = list->next) |
300 { | 306 { |
301 PurpleRequestFieldGroup *group = list->data; | 307 PurpleRequestFieldGroup *group = list->data; |
302 GList *fields = purple_request_field_group_get_fields(group); | 308 GList *fields = purple_request_field_group_get_fields(group); |
303 | 309 |
304 for (; fields ; fields = fields->next) | 310 for (; fields ; fields = fields->next) |
305 { | 311 { |
306 PurpleRequestField *field = fields->data; | 312 PurpleRequestField *field = fields->data; |
307 PurpleRequestFieldType type = purple_request_field_get_type(field); | 313 PurpleRequestFieldType type = purple_request_field_get_type(field); |
308 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) | 314 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) |
367 } | 373 } |
368 } | 374 } |
369 | 375 |
370 purple_notify_close_with_handle(button); | 376 purple_notify_close_with_handle(button); |
371 | 377 |
372 if (!purple_request_fields_all_required_filled(fields)) { | 378 if (!g_object_get_data(G_OBJECT(button), "cancellation-function") && |
379 !purple_request_fields_all_required_filled(fields)) { | |
373 purple_notify_error(button, _("Error"), | 380 purple_notify_error(button, _("Error"), |
374 _("You must fill all the required fields."), | 381 _("You must fill all the required fields."), |
375 _("The required fields are underlined.")); | 382 _("The required fields are underlined.")); |
376 return; | 383 return; |
377 } | 384 } |
651 if (screenname && accountlist) { | 658 if (screenname && accountlist) { |
652 g_signal_connect(screenname, "completion", G_CALLBACK(update_selected_account), accountlist); | 659 g_signal_connect(screenname, "completion", G_CALLBACK(update_selected_account), accountlist); |
653 } | 660 } |
654 | 661 |
655 g_object_set_data(G_OBJECT(window), "fields", allfields); | 662 g_object_set_data(G_OBJECT(window), "fields", allfields); |
656 | 663 |
657 return window; | 664 return window; |
658 } | 665 } |
659 | 666 |
660 static void | 667 static void |
661 file_cancel_cb(gpointer fq, GntWidget *wid) | 668 file_cancel_cb(gpointer fq, GntWidget *wid) |