Mercurial > pidgin
changeset 5498:cce2d7868c78
[gaim-migrate @ 5894]
Bye bye do_ask_dialog()! Mwahahahahhaha!
And wit -> with. What wit with the witty with wit comment, wit you jutht
thaw.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Fri, 23 May 2003 02:42:52 +0000 |
parents | 3c7748b24410 |
children | c8afb821df3e |
files | src/buddy_chat.c src/dialogs.c src/gtkft.c src/gtkrequest.c src/multi.c src/plugin.c src/protocols/irc/irc.c src/protocols/jabber/jabber.c src/protocols/msn/msn.c src/protocols/msn/notification.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/protocols/yahoo/yahoo.c src/prpl.c src/prpl.h src/request.h src/server.c |
diffstat | 17 files changed, 160 insertions(+), 224 deletions(-) [+] |
line wrap: on
line diff
--- a/src/buddy_chat.c Fri May 23 01:45:17 2003 +0000 +++ b/src/buddy_chat.c Fri May 23 02:42:52 2003 +0000 @@ -247,7 +247,7 @@ if (gc == NULL) { gaim_notify_error(NULL, NULL, - _("You are not currently signed on wit any " + _("You are not currently signed on with any " "protocols that have the ability to chat."), NULL);
--- a/src/dialogs.c Fri May 23 01:45:17 2003 +0000 +++ b/src/dialogs.c Fri May 23 02:42:52 2003 +0000 @@ -465,22 +465,34 @@ return; text = g_strdup_printf(_("You are about to remove %s from your buddy list. Do you want to continue?"), name); - do_ask_dialog(_("Remove Buddy"), text, bd, _("Remove Buddy"), do_remove_buddy, _("Cancel"), NULL, NULL, FALSE); + + gaim_request_action(NULL, NULL, _("Remove Buddy"), text, -1, bd, 2, + _("Remove Buddy"), G_CALLBACK(do_remove_buddy), + _("Cancel"), NULL); + g_free(text); } void show_confirm_del_chat(struct chat *chat) { char *text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list. Do you want to continue?"), chat->alias); - do_ask_dialog(_("Remove Chat"), text, chat, _("Remove Chat"), do_remove_chat, _("Cancel"), NULL, NULL, FALSE); + + gaim_request_action(NULL, NULL, _("Remove Chat"), text, -1, chat, 2, + _("Remove Chat"), G_CALLBACK(do_remove_chat), + _("Cancel"), NULL); + g_free(text); } void show_confirm_del_group(struct group *g) { - char *text = g_strdup_printf(_("You are about to remove the group %s and all its members from your buddy list. Do you want to continue?"), + char *text = g_strdup_printf(_("You are about to remove the group %s and all its members from your buddy list. Do you want to continue?"), g->name); - do_ask_dialog(_("Remove Group"), text, g, _("Remove Group"), do_remove_group, _("Cancel"), NULL, NULL, FALSE); + + gaim_request_action(NULL, NULL, _("Remove Group"), text, -1, g, 2, + _("Remove Group"), G_CALLBACK(do_remove_group), + _("Cancel"), NULL); + g_free(text); }
--- a/src/gtkft.c Fri May 23 01:45:17 2003 +0000 +++ b/src/gtkft.c Fri May 23 02:42:52 2003 +0000 @@ -29,6 +29,7 @@ #include "gtkcellrendererprogress.h" #include "gaim-disclosure.h" #include "notify.h" +#include "request.h" #define GAIM_GTKXFER(xfer) \ (struct gaim_gtkxfer_ui_data *)(xfer)->ui_data @@ -1027,12 +1028,12 @@ else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { data->name = g_strdup(name); - do_ask_dialog(_("That file already exists. " - "Would you like to overwrite it?"), - NULL, xfer, - _("Yes"), do_overwrite_cb, - _("No"), dont_overwrite_cb, - NULL, FALSE); + gaim_request_yes_no(NULL, NULL, + _("That file already exists."), + _("Would you like to overwrite it?"), + 1, xfer, + G_CALLBACK(do_overwrite_cb), + G_CALLBACK(dont_overwrite_cb)); } else { gaim_xfer_request_accepted(xfer, g_strdup(name)); @@ -1107,10 +1108,9 @@ g_free(size_buf); - do_ask_dialog(buf, NULL, xfer, - _("Accept"), choose_file, - _("Cancel"), cancel_recv_cb, - NULL, FALSE); + gaim_request_accept_cancel(NULL, NULL, buf, NULL, 0, xfer, + G_CALLBACK(choose_file), + G_CALLBACK(cancel_recv_cb)); g_free(buf); }
--- a/src/gtkrequest.c Fri May 23 01:45:17 2003 +0000 +++ b/src/gtkrequest.c Fri May 23 02:42:52 2003 +0000 @@ -72,7 +72,7 @@ value = gtk_entry_get_text(GTK_ENTRY(data->u.input.entry)); if (id < data->cb_count && data->cbs[id] != NULL) - ((GaimRequestInputCb)data->cbs[id])(value, data->user_data); + ((GaimRequestInputCb)data->cbs[id])(data->user_data, value); gaim_request_close(GAIM_REQUEST_INPUT, data); } @@ -81,7 +81,7 @@ __action_response_cb(GtkDialog *dialog, gint id, GaimRequestData *data) { if (id < data->cb_count && data->cbs[id] != NULL) - ((GaimRequestActionCb)data->cbs[id])(id, data->user_data); + ((GaimRequestActionCb)data->cbs[id])(data->user_data, id); gaim_request_close(GAIM_REQUEST_INPUT, data); }
--- a/src/multi.c Fri May 23 01:45:17 2003 +0000 +++ b/src/multi.c Fri May 23 02:42:52 2003 +0000 @@ -1544,7 +1544,10 @@ g_snprintf(buf, sizeof(buf), _("Are you sure you want to delete %s?"), account->username); - do_ask_dialog(buf, NULL, account, _("Delete"), do_del_acct, _("Cancel"), NULL, NULL, FALSE); + + gaim_request_action(NULL, NULL, buf, NULL, 1, account, 2, + _("Delete"), G_CALLBACK(do_del_acct), + _("Cancel"), NULL); } } @@ -2125,6 +2128,9 @@ GAIM_CONV_ACCOUNT_OFFLINE); } + gaim_request_close_with_handle(gc); + gaim_notify_close_with_handle(gc); + update_privacy_connections(); /* in, out, shake it all about */
--- a/src/plugin.c Fri May 23 01:45:17 2003 +0000 +++ b/src/plugin.c Fri May 23 02:42:52 2003 +0000 @@ -316,7 +316,8 @@ plugin->info->name); /* cancel any pending dialogs the plugin has */ - do_ask_cancel_by_handle(plugin); + gaim_request_close_with_handle(plugin); + gaim_notify_close_with_handle(plugin); plugin->loaded = FALSE;
--- a/src/protocols/irc/irc.c Fri May 23 01:45:17 2003 +0000 +++ b/src/protocols/irc/irc.c Fri May 23 02:42:52 2003 +0000 @@ -997,7 +997,7 @@ } static void -irc_change_nick(const char *b, void *a) { +irc_change_nick(void *a, const char *b) { struct gaim_connection *gc = a; struct irc_data *id = gc->proto_data; char buf[IRC_BUF_LEN]; @@ -1437,7 +1437,14 @@ dccchat->port=atoi(chat_args[4]); g_snprintf(dccchat->nick, sizeof(dccchat->nick), nick); g_snprintf(ask, sizeof(ask), _("%s would like to establish a DCC chat"), nick); - do_ask_dialog(ask, _("This requires a direct connection to be established between the two computers. Messages sent will not pass through the IRC server"), dccchat, _("Connect"), dcc_chat_init, _("Cancel"), dcc_chat_cancel, my_protocol->handle, FALSE); + + gaim_request_action(gc, NULL, ask, + _("This requires a direct connection to be " + "established between the two computers. " + "Messages sent will not pass through the " + "IRC server"), 0, dccchat, 2, + _("Connect"), G_CALLBACK(dcc_chat_init), + _("Cancel"), G_CALLBACK(dcc_chat_cancel)); } else if (!g_ascii_strncasecmp(msg, "DCC SEND", 8)) { struct gaim_xfer *xfer;
--- a/src/protocols/jabber/jabber.c Fri May 23 01:45:17 2003 +0000 +++ b/src/protocols/jabber/jabber.c Fri May 23 02:42:52 2003 +0000 @@ -1661,7 +1661,8 @@ } /* - * Callback from "accept" in do_ask_dialog() invoked by jabber_handles10n() + * Callback from "accept" in gaim_request_action() invoked + * by jabber_handles10n() */ static void jabber_accept_add(struct jabber_add_permit *jap) { @@ -1681,7 +1682,8 @@ } /* - * Callback from "deny/cancel" in do_ask_dialog() invoked by jabber_handles10n() + * Callback from "deny/cancel" in gaim_request_action() invoked + * by jabber_handles10n() */ static void jabber_deny_add(struct jabber_add_permit *jap) { @@ -1715,7 +1717,10 @@ jap->gc = GJ_GC(gjc); jap->user = g_strdup(Jid); - do_ask_dialog(msg, NULL, jap, _("Authorize"), jabber_accept_add, _("Deny"), jabber_deny_add, my_protocol->handle, FALSE); + + gaim_request_action(jap->gc, NULL, msg, NULL, 0, jap, 2, + _("Authorize"), G_CALLBACK(jabber_accept_add), + _("Deny"), G_CALLBACK(jabber_deny_add)); g_free(msg); xmlnode_free(g); /* Never needed it here anyway */
--- a/src/protocols/msn/msn.c Fri May 23 01:45:17 2003 +0000 +++ b/src/protocols/msn/msn.c Fri May 23 02:42:52 2003 +0000 @@ -43,9 +43,8 @@ } MsnMobileData; static void -msn_act_id(const char *entry, void *data) +msn_act_id(struct gaim_connection *gc, const char *entry) { - struct gaim_connection *gc = data; MsnSession *session = gc->proto_data; char outparams[MSN_BUF_LEN]; char *alias; @@ -94,37 +93,37 @@ } static void -msn_set_home_phone_cb(const char *entry, struct gaim_connection *gc) +msn_set_home_phone_cb(struct gaim_connection *gc, const char *entry) { msn_set_prp(gc, "PHH", entry); } static void -msn_set_work_phone_cb(const char *entry, struct gaim_connection *gc) +msn_set_work_phone_cb(struct gaim_connection *gc, const char *entry) { msn_set_prp(gc, "PHW", entry); } static void -msn_set_mobile_phone_cb(const char *entry, struct gaim_connection *gc) +msn_set_mobile_phone_cb(struct gaim_connection *gc, const char *entry) { msn_set_prp(gc, "PHM", entry); } static void -__enable_msn_pages_cb(int id, struct gaim_connection *gc) +__enable_msn_pages_cb(struct gaim_connection *gc) { msn_set_prp(gc, "MOB", "Y"); } static void -__disable_msn_pages_cb(int id, struct gaim_connection *gc) +__disable_msn_pages_cb(struct gaim_connection *gc) { msn_set_prp(gc, "MOB", "N"); } static void -__send_to_mobile_cb(const char *entry, MsnMobileData *data) +__send_to_mobile_cb(MsnMobileData *data, const char *entry) { MsnSession *session = data->gc->proto_data; MsnServConn *servconn = session->notification_conn; @@ -154,7 +153,7 @@ } static void -__close_mobile_page_cb(const char *entry, MsnMobileData *data) +__close_mobile_page_cb(MsnMobileData *data, const char *entry) { g_free(data); } @@ -205,22 +204,6 @@ _("Cancel"), NULL, gc); } -#if 0 -static void -msn_show_set_mobile_support(struct gaim_connection *gc) -{ - MsnSession *session = gc->proto_data; - - do_ask_dialog(_("MSN Mobile Support"), - _("Do you want to enable or disable MSN Mobile " - "device support?"), - gc, - _("Enable"), __enable_msn_mobile_cb, - _("Disable"), __disable_msn_mobile_cb, - session->prpl->handle, FALSE); -} -#endif - static void msn_show_set_mobile_pages(struct gaim_connection *gc) { @@ -228,9 +211,10 @@ _("Do you want to allow or disallow people on " "your buddy list to send you MSN Mobile pages " "to your cell phone or other mobile device?"), - -1, gc, 2, + -1, gc, 3, _("Allow"), G_CALLBACK(__enable_msn_pages_cb), - _("Disallow"), G_CALLBACK(__disable_msn_pages_cb)); + _("Disallow"), G_CALLBACK(__disable_msn_pages_cb), + _("Cancel"), NULL); } static void
--- a/src/protocols/msn/notification.c Fri May 23 01:45:17 2003 +0000 +++ b/src/protocols/msn/notification.c Fri May 23 02:42:52 2003 +0000 @@ -440,10 +440,9 @@ _("The user %s (%s) wants to add %s to his or her buddy list."), passport, friend, gc->username); - do_ask_dialog(msg, NULL, pa, - _("Authorize"), msn_accept_add_cb, - _("Deny"), msn_cancel_add_cb, - session->prpl->handle, FALSE); + gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2, + _("Authorize"), G_CALLBACK(msn_accept_add_cb), + _("Deny"), G_CALLBACK(msn_cancel_add_cb)); return TRUE; } @@ -715,10 +714,11 @@ msn_user_get_passport(pa->user), msn_user_get_name(pa->user)); - do_ask_dialog(msg, NULL, pa, - _("Authorize"), msn_accept_add_cb, - _("Deny"), msn_cancel_add_cb, - session->prpl->handle, FALSE); + gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2, + _("Authorize"), + G_CALLBACK(msn_accept_add_cb), + _("Deny"), + G_CALLBACK(msn_cancel_add_cb)); } }
--- a/src/protocols/oscar/oscar.c Fri May 23 01:45:17 2003 +0000 +++ b/src/protocols/oscar/oscar.c Fri May 23 02:42:52 2003 +0000 @@ -299,7 +299,7 @@ return val; } -static void gaim_free_name_data(const char *text, struct name_data *data) { +static void gaim_free_name_data(struct name_data *data) { g_free(data->name); g_free(data->nick); g_free(data); @@ -2393,7 +2393,15 @@ strncpy(d->ip, args->verifiedip, sizeof(d->ip)); memcpy(d->cookie, args->cookie, 8); g_snprintf(buf, sizeof buf, _("%s has just asked to directly connect to %s"), userinfo->sn, gc->username); - do_ask_dialog(buf, _("This requires a direct connection between the two computers and is necessary for IM Images. Because your IP address will be revealed, this may be considered a privacy risk."), d, _("Connect"), accept_direct_im, _("Cancel"), cancel_direct_im, my_protocol->handle, FALSE); + + gaim_request_action(gc, NULL, buf, + _("This requires a direct connection between " + "the two computers and is necessary for IM " + "Images. Because your IP address will be " + "revealed, this may be considered a privacy " + "risk."), 0, d, 2, + _("Connect"), G_CALLBACK(accept_direct_im), + _("Cancel"), G_CALLBACK(cancel_direct_im)); } else { gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Unknown reqclass %hu\n", args->reqclass); @@ -2408,7 +2416,7 @@ * methods of authorization (SSI and old-school channel 4 ICBM) */ /* When you ask other people for authorization */ -static void gaim_auth_request(char *msg, struct name_data *data) { +static void gaim_auth_request(struct name_data *data, char *msg) { struct gaim_connection *gc = data->gc; if (g_slist_find(connections, gc)) { @@ -2442,7 +2450,7 @@ /* XXX - Take the buddy out of our buddy list */ } - gaim_free_name_data(NULL, data); + gaim_free_name_data(data); } static void gaim_auth_sendrequest(struct gaim_connection *gc, const char *name) { @@ -2460,7 +2468,12 @@ data->gc = gc; data->name = g_strdup(name); data->nick = NULL; - do_ask_dialog(_("Request Authorization"), dialog_msg, data, _("Request Authorization"), gaim_auth_request_msgprompt, _("Cancel"), gaim_auth_dontrequest, my_protocol->handle, FALSE); + + gaim_request_action(gc, NULL, _("Request Authorization"), dialog_msg, + 0, data, 2, + _("Request Authorization"), + G_CALLBACK(gaim_auth_request_msgprompt), + _("Cancel"), G_CALLBACK(gaim_auth_dontrequest)); g_free(dialog_msg); g_free(nombre); @@ -2484,11 +2497,11 @@ #endif } - gaim_free_name_data(NULL, data); + gaim_free_name_data(data); } /* When other people ask you for authorization */ -static void gaim_auth_dontgrant(char *msg, struct name_data *data) { +static void gaim_auth_dontgrant(struct name_data *data, char *msg) { struct gaim_connection *gc = data->gc; if (g_slist_find(connections, gc)) { @@ -2517,7 +2530,7 @@ show_add_buddy(gc, data->name, NULL, data->nick); } - gaim_free_name_data(NULL, data); + gaim_free_name_data(data); } static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t) { @@ -2581,7 +2594,13 @@ data->gc = gc; data->name = g_strdup_printf("%lu", args->uin); data->nick = NULL; - do_ask_dialog(_("Authorization Request"), dialog_msg, data, _("Authorize"), gaim_auth_grant, _("Deny"), gaim_auth_dontgrant_msgprompt, my_protocol->handle, FALSE); + + gaim_request_action(gc, NULL, _("Authorization Request"), + dialog_msg, 0, data, 2, + _("Authorize"), + G_CALLBACK(gaim_auth_grant), + _("Deny"), + G_CALLBACK(gaim_auth_dontgrant_msgprompt)); g_free(dialog_msg); } } break; @@ -2645,7 +2664,13 @@ data->gc = gc; data->name = g_strdup(text[i*2+1]); data->nick = g_strdup(text[i*2+2]); - do_ask_dialog(message, _("Do you want to add this contact to your Buddy List?"), data, _("Add"), gaim_icq_contactadd, _("Decline"), gaim_free_name_data, my_protocol->handle, FALSE); + + gaim_request_action(gc, NULL, message, + _("Do you want to add this contact " + "to your Buddy List?"), + 0, data, 2, + _("Add"), G_CALLBACK(gaim_icq_contactadd), + _("Decline"), G_CALLBACK(gaim_free_name_data)); g_free(message); } g_strfreev(text); @@ -4982,7 +5007,11 @@ data->gc = gc; data->name = g_strdup(sn); data->nick = NULL; - do_ask_dialog(_("Authorization Given"), dialog_msg, data, _("Yes"), gaim_icq_contactadd, _("No"), gaim_free_name_data, my_protocol->handle, FALSE); + + gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg, + 0, data, + G_CALLBACK(gaim_icq_contactadd), + G_CALLBACK(gaim_free_name_data)); g_free(dialog_msg); g_free(nombre); @@ -5017,7 +5046,11 @@ data->gc = gc; data->name = g_strdup(sn); data->nick = NULL; - do_ask_dialog(_("Authorization Request"), dialog_msg, data, _("Authorize"), gaim_auth_grant, _("Deny"), gaim_auth_dontgrant_msgprompt, my_protocol->handle, FALSE); + + gaim_request_action(gc, NULL, _("Authorization Request"), dialog_msg, + 0, data, 2, + _("Authorize"), G_CALLBACK(gaim_auth_grant), + _("Deny"), G_CALLBACK(gaim_auth_dontgrant_msgprompt)); g_free(dialog_msg); g_free(nombre); @@ -5561,7 +5594,14 @@ data->who = g_strdup(who); data->gc = gc; buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."), who); - do_ask_dialog(buf, _("Because this reveals your IP address, it may be considered a privacy risk. Do you wish to continue?"), data, _("Connect"), oscar_direct_im, _("Cancel"), oscar_cancel_direct_im, my_protocol->handle, FALSE); + + gaim_request_action(gc, NULL, buf, + _("Because this reveals your IP address, it " + "may be considered a privacy risk. Do you " + "wish to continue?"), + 0, data, 2, + _("Connect"), G_CALLBACK(oscar_direct_im), + _("Cancel"), G_CALLBACK(oscar_cancel_direct_im)); g_free(buf); } @@ -5744,7 +5784,7 @@ return m; } -static void oscar_format_screenname(const char *nick, struct gaim_connection *gc) { +static void oscar_format_screenname(struct gaim_connection *gc, const char *nick) { struct oscar_data *od = gc->proto_data; if (!aim_sncmp(gc->username, nick)) { if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { @@ -5795,7 +5835,7 @@ } } -static void oscar_change_email(const char *email, struct gaim_connection *gc) +static void oscar_change_email(struct gaim_connection *gc, const char *email) { struct oscar_data *od = gc->proto_data; aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH);
--- a/src/protocols/toc/toc.c Fri May 23 01:45:17 2003 +0000 +++ b/src/protocols/toc/toc.c Fri May 23 02:42:52 2003 +0000 @@ -1988,7 +1988,10 @@ } else { g_snprintf(buf, sizeof(buf), _("%s requests you to send them a file"), ft->user); } - do_ask_dialog(buf, NULL, ft, _("Accept"), toc_accept_ft, _("Cancel"), toc_reject_ft, my_protocol->handle, FALSE); + + gaim_request_accept_cancel(ft->gc, NULL, buf, NULL, 0, ft, + G_CALLBACK(toc_accept_ft), + G_CALLBACK(toc_reject_ft)); } static GaimPluginProtocolInfo prpl_info =
--- a/src/protocols/yahoo/yahoo.c Fri May 23 01:45:17 2003 +0000 +++ b/src/protocols/yahoo/yahoo.c Fri May 23 02:42:52 2003 +0000 @@ -1184,9 +1184,8 @@ return m; } -static void yahoo_act_id(const char *entry, gpointer data) +static void yahoo_act_id(struct gaim_connection *gc, const char *entry) { - struct gaim_connection *gc = data; struct yahoo_data *yd = gc->proto_data; struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, 0);
--- a/src/prpl.c Fri May 23 01:45:17 2003 +0000 +++ b/src/prpl.c Fri May 23 02:42:52 2003 +0000 @@ -66,118 +66,6 @@ return NULL; } -static GSList *do_ask_dialogs = NULL; - -struct doaskstruct { - GtkWidget *dialog; - GModule *handle; - void (*yesfunc)(gpointer); - void (*nofunc)(gpointer); - gpointer data; -}; - -void do_ask_cancel_by_handle(void *handle) -{ - GSList *d = do_ask_dialogs; - - gaim_debug(GAIM_DEBUG_MISC, "prpl", - "%d dialogs to search\n", g_slist_length(d)); - - while (d) { - struct doaskstruct *doask = d->data; - - d = d->next; - - if (doask->handle == handle) { - gaim_debug(GAIM_DEBUG_MISC, "prpl", - "Removing dialog, %d remain\n", g_slist_length(d)); - gtk_dialog_response(GTK_DIALOG(doask->dialog), GTK_RESPONSE_NONE); - } - } -} - -static void do_ask_callback(GtkDialog *d, gint resp, struct doaskstruct *doask) -{ - switch (resp) - { - case GTK_RESPONSE_YES: - if (doask->yesfunc) - doask->yesfunc(doask->data); - break; - default: - if (doask->nofunc) - doask->nofunc(doask->data); - break; - } - do_ask_dialogs = g_slist_remove(do_ask_dialogs, doask); - g_free(doask); - gtk_widget_destroy(GTK_WIDGET(d)); -} - -#define STOCK_ITEMIZE(r, l) if (!strcmp(r,yestext)) \ - yestext = l; \ - if (!strcmp(r,notext)) \ - notext = l; - -void do_ask_dialog(const char *prim, const char *sec, void *data, char *yestext, void *doit, char *notext, void *dont, GModule *handle, gboolean modal) -{ - GtkWidget *window; - GtkWidget *hbox; - GtkWidget *label; - char labeltext[1024 * 2]; - GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); - struct doaskstruct *doask = g_new0(struct doaskstruct, 1); - - gtk_misc_set_alignment(GTK_MISC(img), 0, 0); - - /* This is ugly. GTK Stock items will take a button with a label "gtk-cancel" and turn it into a - * Cancel button with a Cancel icon and whatnot. We want to avoid using anything gtk in the prpls - * so we replace "Cancel" with "gtk-cancel" right here. */ - STOCK_ITEMIZE("Add", GTK_STOCK_ADD); - STOCK_ITEMIZE("Apply", GTK_STOCK_APPLY); - STOCK_ITEMIZE("Cancel", GTK_STOCK_CANCEL); - STOCK_ITEMIZE("Close", GTK_STOCK_CLOSE); - STOCK_ITEMIZE("Delete", GTK_STOCK_DELETE); - STOCK_ITEMIZE("Remove", GTK_STOCK_REMOVE); - STOCK_ITEMIZE("Yes", GTK_STOCK_YES); - STOCK_ITEMIZE("No", GTK_STOCK_NO); - - window = gtk_dialog_new_with_buttons("", NULL, 0, notext, GTK_RESPONSE_NO, yestext, GTK_RESPONSE_YES, NULL); - - if (modal) { - gtk_window_set_modal(GTK_WINDOW(window), TRUE); - } - - gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_YES); - g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(do_ask_callback), doask); - - gtk_container_set_border_width (GTK_CONTAINER(window), 6); - gtk_window_set_resizable(GTK_WINDOW(window), FALSE); - gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE); - gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), 12); - gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), 6); - - hbox = gtk_hbox_new(FALSE, 12); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox); - gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); - - g_snprintf(labeltext, sizeof(labeltext), "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", prim, sec ? sec : ""); - label = gtk_label_new(NULL); - gtk_label_set_markup(GTK_LABEL(label), labeltext); - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - - doask->dialog = window; - doask->handle = handle; - doask->yesfunc = doit; - doask->nofunc = dont; - doask->data = data; - do_ask_dialogs = g_slist_append(do_ask_dialogs, doask); - - gtk_widget_show_all(window); -} - static void proto_act(GtkObject *obj, struct proto_actions_menu *pam) { if (pam->callback && pam->gc) @@ -628,8 +516,10 @@ gaim_notify_info(NULL, NULL, _("Gaim - Information"), buf); } else - do_ask_dialog(_("Gaim - Confirm"), buf, ga, - _("Add"), do_add, _("Cancel"), dont_add, NULL, FALSE); + gaim_request_action(NULL, NULL, _("Add buddy to your list?"), buf, + 0, ga, 2, + _("Add"), G_CALLBACK(do_add), + _("Cancel"), G_CALLBACK(dont_add)); } static GtkWidget *regdlg = NULL;
--- a/src/prpl.h Fri May 23 01:45:17 2003 +0000 +++ b/src/prpl.h Fri May 23 02:42:52 2003 +0000 @@ -346,30 +346,6 @@ const char *who, const char *alias, const char *msg); /** - * Closes do_ask_dialogs when the associated plugin is unloaded. - * - * @param handle The handle. - */ -void do_ask_cancel_by_handle(void *handle); - -/** - * Asks the user a question and acts on the response. - * - * @param prim The primary question. - * @param sec The secondary question. - * @param data The data to be passed to a callback. - * @param yestext The text for the Yes button. - * @param doit The callback function to call when the Yes button is clicked. - * @param notext The text for the No button. - * @param dont The callback function to call when the No button is clicked. - * @param handle The module handle to associate with this dialog, or @c NULL. - * @param modal @c TRUE if the dialog should be modal; @c FALSE otherwise. - */ -void do_ask_dialog(const char *prim, const char *sec, void *data, - char *yestext, void *doit, char *notext, void *dont, - GModule *handle, gboolean modal); - -/** * Called to notify the user that the account has new mail. * * If @a count is less than 0, the dialog will display the the sender
--- a/src/request.h Fri May 23 01:45:17 2003 +0000 +++ b/src/request.h Fri May 23 02:42:52 2003 +0000 @@ -64,8 +64,8 @@ } GaimRequestUiOps; -typedef void (*GaimRequestInputCb)(const char *, void *); -typedef void (*GaimRequestActionCb)(int, void *); +typedef void (*GaimRequestInputCb)(void *, const char *); +typedef void (*GaimRequestActionCb)(void *, int); /**************************************************************************/ /** @name Request API */ @@ -213,18 +213,28 @@ */ #define gaim_request_yes_no(handle, title, primary, secondary, \ default_action, user_data, yes_cb, no_cb) \ - gaim_request_action((handle), (title), (primary), (secondary) \ - (default_action), (user_data), \ - _("Yes"), (yes_cb), _("No"), (no_cb), NULL) + gaim_request_action((handle), (title), (primary), (secondary), \ + (default_action), (user_data), 2, \ + _("Yes"), (yes_cb), _("No"), (no_cb)) /** * A wrapper for gaim_request_action() that uses OK and Cancel buttons. */ #define gaim_request_ok_cancel(handle, title, primary, secondary, \ default_action, user_data, ok_cb, cancel_cb) \ - gaim_request_action((handle), (title), (primary), (secondary) \ - (default_action), (user_data), \ - _("OK"), (ok_cb), _("Cancel"), (cancel_cb), NULL) + gaim_request_action((handle), (title), (primary), (secondary), \ + (default_action), (user_data), 2, \ + _("OK"), (ok_cb), _("Cancel"), (cancel_cb)) + +/** + * A wrapper for gaim_request_action() that uses Accept and Cancel buttons. + */ +#define gaim_request_accept_cancel(handle, title, primary, secondary, \ + default_action, user_data, accept_cb, \ + cancel_cb) \ + gaim_request_action((handle), (title), (primary), (secondary), \ + (default_action), (user_data), 2, \ + _("Accept"), (accept_cb), _("Cancel"), (cancel_cb)) /*@}*/
--- a/src/server.c Fri May 23 01:45:17 2003 +0000 +++ b/src/server.c Fri May 23 02:42:52 2003 +0000 @@ -1236,7 +1236,10 @@ cid->gc = gc; cid->components = data; - do_ask_dialog(_("Buddy Chat Invite"), buf2, cid, _("Accept"), chat_invite_accept, _("Cancel"), chat_invite_data_free, NULL, FALSE); + gaim_request_accept_cancel(gc, NULL, _("Accept chat invitation?"), + buf2, 0, cid, + G_CALLBACK(chat_invite_accept), + G_CALLBACK(chat_invite_data_free)); } struct gaim_conversation *serv_got_joined_chat(struct gaim_connection *gc,