changeset 22136:9df0a8c7c9b7

* Clarify the documentation for purple_request_action's 'default_ation' It should be the action that users are most likely to choose * Fix Pidgin's request_action dialog to correctly set the default action based on the input value. We were counting from the button on the left and moving right but we should have started counting from the button on the right and moved left, because that's the order the actions are specified in when passed to purple_request_action.
author Mark Doliner <mark@kingant.net>
date Thu, 17 Jan 2008 07:21:04 +0000
parents 3550c5d7c493
children 6dab6629497a
files libpurple/request.h pidgin/gtkrequest.c
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/request.h	Thu Jan 17 06:17:02 2008 +0000
+++ b/libpurple/request.h	Thu Jan 17 07:21:04 2008 +0000
@@ -1318,6 +1318,8 @@
  * @param secondary      Secondary information, or @c NULL if there is none.
  * @param default_action The default action, zero-indexed; if the third action
  *                       supplied should be the default, supply <tt>2</tt>.
+ *                       The should be the action that users are most likely
+ *                       to select.
  * @param account        The #PurpleAccount associated with this request, or @c
  *                       NULL if none is.
  * @param who            The username of the buddy associated with this request,
@@ -1356,6 +1358,8 @@
  * @param secondary      Secondary information, or @c NULL if there is none.
  * @param default_action The default action, zero-indexed; if the third action
  *                       supplied should be the default, supply <tt>2</tt>.
+ *                       The should be the action that users are most likely
+ *                       to select.
  * @param account        The #PurpleAccount associated with this request, or @c
  *                       NULL if none is.
  * @param who            The username of the buddy associated with this request,
--- a/pidgin/gtkrequest.c	Thu Jan 17 06:17:02 2008 +0000
+++ b/pidgin/gtkrequest.c	Thu Jan 17 07:21:04 2008 +0000
@@ -663,7 +663,11 @@
 		gtk_widget_grab_focus(img);
 		gtk_widget_grab_default(img);
 	} else
-		gtk_dialog_set_default_response(GTK_DIALOG(dialog), default_action);
+		/*
+		 * Need to invert the default_action number because the
+		 * buttons are added to the dialog in reverse order.
+		 */
+		gtk_dialog_set_default_response(GTK_DIALOG(dialog), action_count - 1 - default_action);
 
 	/* Show everything. */
 	pidgin_auto_parent_window(dialog);