Mercurial > pidgin
changeset 5817:571e895bf6ba
[gaim-migrate @ 6247]
The buttons on GTK+ multi-field dialogs are now actually called, but they
have not been tested.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 09 Jun 2003 01:54:51 +0000 |
parents | 64a164aa6f70 |
children | eb9cfee31244 |
files | src/gtkrequest.c |
diffstat | 1 files changed, 37 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkrequest.c Sun Jun 08 23:17:11 2003 +0000 +++ b/src/gtkrequest.c Mon Jun 09 01:54:51 2003 +0000 @@ -48,6 +48,12 @@ } input; + struct + { + GaimRequestFields *fields; + + } multifield; + } u; } GaimGtkRequestData; @@ -86,6 +92,26 @@ gaim_request_close(GAIM_REQUEST_INPUT, data); } +static void +multifield_ok_cb(GtkWidget *button, GaimGtkRequestData *data) +{ + if (data->cbs[0] != NULL) + ((GaimRequestFieldsCb)data->cbs[0])(data->user_data, + data->u.multifield.fields); + + gaim_request_close(GAIM_REQUEST_FIELDS, data); +} + +static void +multifield_cancel_cb(GtkWidget *button, GaimGtkRequestData *data) +{ + if (data->cbs[1] != NULL) + ((GaimRequestFieldsCb)data->cbs[1])(data->user_data, + data->u.multifield.fields); + + gaim_request_close(GAIM_REQUEST_FIELDS, data); +} + #define STOCK_ITEMIZE(r, l) \ if (!strcmp((r), text)) \ return (l); @@ -353,6 +379,7 @@ data = g_new0(GaimGtkRequestData, 1); data->type = GAIM_REQUEST_FIELDS; data->user_data = user_data; + data->u.multifield.fields = fields; data->cb_count = 2; data->cbs = g_new0(GCallback, 2); @@ -361,7 +388,7 @@ data->cbs[1] = cancel_cb; data->dialog = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_role(GTK_WINDOW(win), "fields request"); + gtk_window_set_role(GTK_WINDOW(win), "multifield"); gtk_container_set_border_width(GTK_CONTAINER(win), 12); gtk_window_set_resizable(GTK_WINDOW(win), FALSE); @@ -581,11 +608,17 @@ gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); gtk_widget_show(button); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(multifield_cancel_cb), data); + /* OK button */ button = gtk_button_new_from_stock(text_to_stock(ok_text)); gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); gtk_widget_show(button); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(multifield_ok_cb), data); + gtk_widget_show(win); return data; @@ -599,6 +632,9 @@ if (data->cbs != NULL) g_free(data->cbs); + if (type == GAIM_REQUEST_FIELDS) + gaim_request_fields_destroy(data->u.multifield.fields); + gtk_widget_destroy(data->dialog); g_free(data);