| 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, *button; |
| 120 g_object_set_data(G_OBJECT(button), "activate-userdata", userdata); |
122 g_object_set_data(G_OBJECT(button), "activate-userdata", userdata); |
| 121 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(action_performed), win); |
123 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(action_performed), win); |
| 122 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data); |
124 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data); |
| 123 } |
125 } |
| 124 |
126 |
| |
127 g_object_set_data(G_OBJECT(button), "cancellation-function", GINT_TO_POINTER(TRUE)); |
| |
128 |
| 125 va_end(list); |
129 va_end(list); |
| 126 return box; |
130 return box; |
| 127 } |
131 } |
| 128 |
132 |
| 129 static void |
133 static void |
| 298 * here, althought it can be done. */ |
302 * here, althought it can be done. */ |
| 299 for (list = purple_request_fields_get_groups(fields); list; list = list->next) |
303 for (list = purple_request_fields_get_groups(fields); list; list = list->next) |
| 300 { |
304 { |
| 301 PurpleRequestFieldGroup *group = list->data; |
305 PurpleRequestFieldGroup *group = list->data; |
| 302 GList *fields = purple_request_field_group_get_fields(group); |
306 GList *fields = purple_request_field_group_get_fields(group); |
| 303 |
307 |
| 304 for (; fields ; fields = fields->next) |
308 for (; fields ; fields = fields->next) |
| 305 { |
309 { |
| 306 PurpleRequestField *field = fields->data; |
310 PurpleRequestField *field = fields->data; |
| 307 PurpleRequestFieldType type = purple_request_field_get_type(field); |
311 PurpleRequestFieldType type = purple_request_field_get_type(field); |
| 308 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) |
312 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) |
| 367 } |
371 } |
| 368 } |
372 } |
| 369 |
373 |
| 370 purple_notify_close_with_handle(button); |
374 purple_notify_close_with_handle(button); |
| 371 |
375 |
| 372 if (!purple_request_fields_all_required_filled(fields)) { |
376 if (!g_object_get_data(G_OBJECT(button), "cancellation-function") && |
| |
377 !purple_request_fields_all_required_filled(fields)) { |
| 373 purple_notify_error(button, _("Error"), |
378 purple_notify_error(button, _("Error"), |
| 374 _("You must fill all the required fields."), |
379 _("You must fill all the required fields."), |
| 375 _("The required fields are underlined.")); |
380 _("The required fields are underlined.")); |
| 376 return; |
381 return; |
| 377 } |
382 } |
| 651 if (screenname && accountlist) { |
656 if (screenname && accountlist) { |
| 652 g_signal_connect(screenname, "completion", G_CALLBACK(update_selected_account), accountlist); |
657 g_signal_connect(screenname, "completion", G_CALLBACK(update_selected_account), accountlist); |
| 653 } |
658 } |
| 654 |
659 |
| 655 g_object_set_data(G_OBJECT(window), "fields", allfields); |
660 g_object_set_data(G_OBJECT(window), "fields", allfields); |
| 656 |
661 |
| 657 return window; |
662 return window; |
| 658 } |
663 } |
| 659 |
664 |
| 660 static void |
665 static void |
| 661 file_cancel_cb(gpointer fq, GntWidget *wid) |
666 file_cancel_cb(gpointer fq, GntWidget *wid) |