changeset 9948:b13013595c08

[gaim-migrate @ 10844] "This disables the default action and focus for certain dialogs which use gaim_request_action such as the file transfer dialog ('do you wish to receive this file'). Note that this will require the user to either click the button of their choice or tab to the button of choice and press enter or space. Should fix Bug #1020523 I'll submit another patch to clean up the rest of the dialogs once I hear back from the rest of the team as to how the desired behavior should be. --dw " committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 04 Sep 2004 03:33:16 +0000
parents 3726addc1c97
children ced29c7b396c
files src/away.c src/gtkdialogs.c src/gtkrequest.c src/protocols/msn/userlist.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/request.h
diffstat 7 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/away.c	Fri Sep 03 21:58:30 2004 +0000
+++ b/src/away.c	Sat Sep 04 03:33:16 2004 +0000
@@ -362,7 +362,8 @@
 
 	text = g_strdup_printf(_("Are you sure you want to remove the away message \"%s\"?"), a->name);
 
-	gaim_request_action(NULL, NULL, _("Remove Away Message"), text, -1, g_strdup(a->name), 2,
+	gaim_request_action(NULL, NULL, _("Remove Away Message"), text, 
+						GAIM_DEFAULT_ACTION_NONE, g_strdup(a->name), 2,
 						_("Remove"), G_CALLBACK(do_rem_away_mess),
 						_("Cancel"), G_CALLBACK(g_free));
 
--- a/src/gtkdialogs.c	Fri Sep 03 21:58:30 2004 +0000
+++ b/src/gtkdialogs.c	Sat Sep 04 03:33:16 2004 +0000
@@ -753,7 +753,8 @@
 		gchar *text = g_strdup_printf(_("You are about to remove the contact containing %s and %d other buddies from your buddy list.  Do you want to continue?"),
 			       buddy->name, contact->totalsize - 1);
 
-		gaim_request_action(NULL, NULL, _("Remove Contact"), text, -1, contact, 2,
+		gaim_request_action(NULL, NULL, _("Remove Contact"), text, 
+				GAIM_DEFAULT_ACTION_NONE, contact, 2,
 				_("Remove Contact"), G_CALLBACK(gaim_gtkdialogs_remove_contact_cb),
 				_("Cancel"), NULL);
 
@@ -855,7 +856,8 @@
 	text = g_strdup_printf(_("You are about to remove %s from your buddy list.  Do you want to continue?"),
 						   buddy->name);
 
-	gaim_request_action(NULL, NULL, _("Remove Buddy"), text, -1, buddy, 2,
+	gaim_request_action(NULL, NULL, _("Remove Buddy"), text, 
+						GAIM_DEFAULT_ACTION_NONE, buddy, 2,
 						_("Remove Buddy"), G_CALLBACK(gaim_gtkdialogs_remove_buddy_cb),
 						_("Cancel"), NULL);
 
--- a/src/gtkrequest.c	Fri Sep 03 21:58:30 2004 +0000
+++ b/src/gtkrequest.c	Sat Sep 04 03:33:16 2004 +0000
@@ -521,7 +521,13 @@
 
 	g_free(label_text);
 
-	if (default_action != -1)
+
+    if (default_action == GAIM_DEFAULT_ACTION_NONE && img != NULL) {
+		GTK_WIDGET_SET_FLAGS(img, GTK_CAN_DEFAULT);		
+		GTK_WIDGET_SET_FLAGS(img, GTK_CAN_FOCUS);		
+		gtk_widget_grab_focus(img);
+		gtk_widget_grab_default(img);
+    } else
 		gtk_dialog_set_default_response(GTK_DIALOG(dialog), default_action);
 
 	/* Show everything. */
--- a/src/protocols/msn/userlist.c	Fri Sep 03 21:58:30 2004 +0000
+++ b/src/protocols/msn/userlist.c	Sat Sep 04 03:33:16 2004 +0000
@@ -96,7 +96,8 @@
 				   passport, gaim_account_get_username(gc->account));
 	}
 
-	gaim_request_action(gc, NULL, msg, NULL, 0, pa, 2,
+	gaim_request_action(gc, NULL, msg, NULL, 
+						GAIM_DEFAULT_ACTION_NONE, pa, 2,
 						_("Authorize"), G_CALLBACK(msn_accept_add_cb),
 						_("Deny"), G_CALLBACK(msn_cancel_add_cb));
 
--- a/src/protocols/oscar/oscar.c	Fri Sep 03 21:58:30 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Sat Sep 04 03:33:16 2004 +0000
@@ -3713,8 +3713,8 @@
 				data->nick = NULL;
 
 				gaim_request_action(gc, NULL, _("Authorization Request"),
-									dialog_msg, 0, data, 2,
-									_("Authorize"),
+									dialog_msg, GAIM_DEFAULT_ACTION_NONE, data,
+									2, _("Authorize"),
 									G_CALLBACK(gaim_auth_grant),
 									_("Deny"),
 									G_CALLBACK(gaim_auth_dontgrant_msgprompt));
--- a/src/protocols/toc/toc.c	Fri Sep 03 21:58:30 2004 +0000
+++ b/src/protocols/toc/toc.c	Sat Sep 04 03:33:16 2004 +0000
@@ -2099,7 +2099,8 @@
 		g_snprintf(buf, sizeof(buf), _("%s requests you to send them a file"), ft->user);
 	}
 
-	gaim_request_accept_cancel(ft->gc, NULL, buf, NULL, 0, ft,
+	gaim_request_accept_cancel(ft->gc, NULL, buf, NULL, 
+								GAIM_DEFAULT_ACTION_NONE, ft,
 							   G_CALLBACK(toc_accept_ft),
 							   G_CALLBACK(toc_reject_ft));
 }
--- a/src/request.h	Fri Sep 03 21:58:30 2004 +0000
+++ b/src/request.h	Sat Sep 04 03:33:16 2004 +0000
@@ -31,6 +31,8 @@
 
 #include "account.h"
 
+#define GAIM_DEFAULT_ACTION_NONE	-1
+
 /**
  * Request types.
  */