changeset 5493:3e8487580024

[gaim-migrate @ 5889] Everything is now moved to the new gaim_request_input(). committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 22 May 2003 20:50:30 +0000
parents a75a952d78db
children d557a53e35c5
files src/protocols/irc/irc.c src/protocols/oscar/oscar.c src/protocols/yahoo/yahoo.c src/prpl.c src/prpl.h
diffstat 5 files changed, 39 insertions(+), 102 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/irc/irc.c	Thu May 22 20:50:05 2003 +0000
+++ b/src/protocols/irc/irc.c	Thu May 22 20:50:30 2003 +0000
@@ -997,7 +997,7 @@
 }
 
 static void 
-irc_change_nick(void *a, char *b) {
+irc_change_nick(const char *b, void *a) {
 	struct gaim_connection *gc = a;
 	struct irc_data *id = gc->proto_data;
 	char buf[IRC_BUF_LEN];	
@@ -1111,7 +1111,11 @@
 						  _("IRC Error"));
 		break;		
 	case 433:
-		do_prompt_dialog(_("That nick is already in use.  Please enter a new nick"), gc->displayname, gc, irc_change_nick, NULL);
+		gaim_request_input(gc, NULL, _("That nick is already in use.  "
+									   "Please enter a new nick"),
+						   NULL, gc->displayname, FALSE,
+						   _("OK"), G_CALLBACK(irc_change_nick),
+						   _("Cancel"), NULL, gc);
 		break;
 	default:
 		/* Other error messages */
--- a/src/protocols/oscar/oscar.c	Thu May 22 20:50:05 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Thu May 22 20:50:30 2003 +0000
@@ -299,7 +299,7 @@
 		return val;
 }
 
-static void gaim_free_name_data(struct name_data *data) {
+static void gaim_free_name_data(const char *text, struct name_data *data) {
 	g_free(data->name);
 	g_free(data->nick);
 	g_free(data);
@@ -2408,7 +2408,7 @@
  * methods of authorization (SSI and old-school channel 4 ICBM)
  */
 /* When you ask other people for authorization */
-static void gaim_auth_request(struct name_data *data, char *msg) {
+static void gaim_auth_request(char *msg, struct name_data *data) {
 	struct gaim_connection *gc = data->gc;
 
 	if (g_slist_find(connections, gc)) {
@@ -2427,7 +2427,11 @@
 }
 
 static void gaim_auth_request_msgprompt(struct name_data *data) {
-	do_prompt_dialog(_("Authorization Request Message:"), _("Please authorize me!"), data, gaim_auth_request, gaim_free_name_data);
+	gaim_request_input(data->gc, NULL, _("Authorization Request Message:"),
+					   NULL, _("Please authorize me!"), TRUE,
+					   _("OK"), G_CALLBACK(gaim_auth_request),
+					   _("Cancel"), G_CALLBACK(gaim_free_name_data),
+					   data);
 }
 
 static void gaim_auth_dontrequest(struct name_data *data) {
@@ -2438,7 +2442,7 @@
 		/* XXX - Take the buddy out of our buddy list */
 	}
 
-	gaim_free_name_data(data);
+	gaim_free_name_data(NULL, data);
 }
 
 static void gaim_auth_sendrequest(struct gaim_connection *gc, const char *name) {
@@ -2480,11 +2484,11 @@
 #endif
 	}
 
-	gaim_free_name_data(data);
+	gaim_free_name_data(NULL, data);
 }
 
 /* When other people ask you for authorization */
-static void gaim_auth_dontgrant(struct name_data *data, char *msg) {
+static void gaim_auth_dontgrant(char *msg, struct name_data *data) {
 	struct gaim_connection *gc = data->gc;
 
 	if (g_slist_find(connections, gc)) {
@@ -2498,7 +2502,11 @@
 }
 
 static void gaim_auth_dontgrant_msgprompt(struct name_data *data) {
-	do_prompt_dialog(_("Authorization Denied Message:"), _("No reason given."), data, gaim_auth_dontgrant, gaim_free_name_data);
+	gaim_request_input(data->gc, NULL, _("Authorization Denied Message:"),
+					   NULL, _("No reason given."), TRUE,
+					   _("OK"), G_CALLBACK(gaim_auth_dontgrant),
+					   _("Cancel"), G_CALLBACK(gaim_free_name_data),
+					   data);
 }
 
 /* When someone sends you contacts  */
@@ -2509,7 +2517,7 @@
 		show_add_buddy(gc, data->name, NULL, data->nick);
 	}
 
-	gaim_free_name_data(data);
+	gaim_free_name_data(NULL, 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) {
@@ -5735,7 +5743,7 @@
 	return m;
 }
 
-static void oscar_format_screenname(struct gaim_connection *gc, char *nick) {
+static void oscar_format_screenname(const char *nick, struct gaim_connection *gc) {
 	struct oscar_data *od = gc->proto_data;
 	if (!aim_sncmp(gc->username, nick)) {
 		if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) {
@@ -5753,7 +5761,11 @@
 
 static void oscar_show_format_screenname(struct gaim_connection *gc)
 {
-	do_prompt_dialog(_("New screenname formatting:"), gc->displayname, gc, oscar_format_screenname, NULL);
+	gaim_request_input(gc, NULL, _("New screenname formatting:"), NULL,
+					   gc->displayname, FALSE,
+					   _("OK"), G_CALLBACK(oscar_format_screenname),
+					   _("Cancel"), NULL,
+					   gc);
 }
 
 static void oscar_confirm_account(struct gaim_connection *gc)
@@ -5782,7 +5794,7 @@
 	}
 }
 
-static void oscar_change_email(struct gaim_connection *gc, char *email)
+static void oscar_change_email(const char *email, struct gaim_connection *gc)
 {
 	struct oscar_data *od = gc->proto_data;
 	aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH);
@@ -5798,7 +5810,10 @@
 
 static void oscar_show_change_email(struct gaim_connection *gc)
 {
-	do_prompt_dialog(_("Change Address To: "), NULL, gc, oscar_change_email, NULL);
+	gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, FALSE,
+					   _("OK"), G_CALLBACK(oscar_change_email),
+					   _("Cancel"), NULL,
+					   gc);
 }
 
 static void oscar_show_awaitingauth(struct gaim_connection *gc)
--- a/src/protocols/yahoo/yahoo.c	Thu May 22 20:50:05 2003 +0000
+++ b/src/protocols/yahoo/yahoo.c	Thu May 22 20:50:30 2003 +0000
@@ -56,7 +56,7 @@
 /* for win32 compatability */
 G_MODULE_IMPORT GSList *connections;
 
-#define YAHOO_DEBUG
+/* #define YAHOO_DEBUG */
 
 #define USEROPT_MAIL 0
 
@@ -1184,7 +1184,7 @@
 	return m;
 }
 
-static void yahoo_act_id(gpointer data, char *entry)
+static void yahoo_act_id(const char *entry, gpointer data)
 {
 	struct gaim_connection *gc = data;
 	struct yahoo_data *yd = gc->proto_data;
@@ -1199,7 +1199,10 @@
 
 static void yahoo_show_act_id(struct gaim_connection *gc)
 {
-	do_prompt_dialog("Activate which ID:", gc->displayname, gc, yahoo_act_id, NULL);
+	gaim_request_input(gc, NULL, _("Active which ID?"), NULL,
+					   gc->displayname, FALSE,
+					   _("OK"), G_CALLBACK(yahoo_act_id),
+					   _("Cancel"), NULL, gc);
 }
 
 static GList *yahoo_actions(struct gaim_connection *gc) {
--- a/src/prpl.c	Thu May 22 20:50:05 2003 +0000
+++ b/src/prpl.c	Thu May 22 20:50:30 2003 +0000
@@ -183,79 +183,6 @@
 	gtk_widget_show_all(window);
 }
 
-static void des_prompt(GtkWidget *w, struct _prompt *p)
-{
-	if (p->dont)
-		(p->dont)(p->data);
-	gtk_widget_destroy(p->window);
-	g_free(p);
-}
-
-static void act_prompt(GtkWidget *w, struct _prompt *p)
-{
-	if (p->doit)
-		(p->doit)(p->data, gtk_entry_get_text(GTK_ENTRY(p->entry)));
-	gtk_widget_destroy(p->window);
-}
-
-void do_prompt_dialog(const char *text, const char *def, void *data, void *doit, void *dont)
-{
-	GtkWidget *window;
-	GtkWidget *vbox;
-	GtkWidget *hbox;
-	GtkWidget *label;
-	GtkWidget *entry;
-	GtkWidget *button;
-	struct _prompt *p;
-
-	p = g_new0(struct _prompt, 1);
-	p->data = data;
-	p->doit = doit;
-	p->dont = dont;
-
-	GAIM_DIALOG(window);
-	p->window = window;
-	gtk_window_set_role(GTK_WINDOW(window), "prompt");
-	gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
-	gtk_window_set_title(GTK_WINDOW(window), _("Gaim - Prompt"));
-	g_signal_connect(G_OBJECT(window), "destroy",
-					 G_CALLBACK(des_prompt), p);
-	gtk_widget_realize(window);
-
-	vbox = gtk_vbox_new(FALSE, 5);
-	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
-	gtk_container_add(GTK_CONTAINER(window), vbox);
-
-	hbox = gtk_hbox_new(FALSE, 5);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-
-	label = gtk_label_new(text);
-	gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
-
-	entry = gtk_entry_new();
-	gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
-	if (def)
-		gtk_entry_set_text(GTK_ENTRY(entry), def);
-	g_signal_connect(G_OBJECT(entry), "activate",
-					 G_CALLBACK(act_prompt), p);
-	p->entry = entry;
-
-	hbox = gtk_hbox_new(FALSE, 5);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-
-	button = gaim_pixbuf_button_from_stock(_("OK"), GTK_STOCK_OK, GAIM_BUTTON_HORIZONTAL);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(act_prompt), p);
-
-	button = gaim_pixbuf_button_from_stock(_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	g_signal_connect(G_OBJECT(button), "clicked",
-					 G_CALLBACK(des_win), window);
-
-	gtk_widget_show_all(window);
-}
-
 static void proto_act(GtkObject *obj, struct proto_actions_menu *pam)
 {
 	if (pam->callback && pam->gc)
--- a/src/prpl.h	Thu May 22 20:50:05 2003 +0000
+++ b/src/prpl.h	Thu May 22 20:50:30 2003 +0000
@@ -370,18 +370,6 @@
 				   GModule *handle, gboolean modal);
 
 /**
- * Prompts the user for data.
- *
- * @param text The text to present to the user.
- * @param def  The default data, or @c NULL.
- * @param data The data to be passed to the callback.
- * @param doit The callback function to call when the Accept button is clicked.
- * @param dont The callback function to call when the Cancel button is clicked.
- */
-void do_prompt_dialog(const char *text, const char *sdef, void *data,
-					  void *doit, void *dont);
-
-/**
  * 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