changeset 22096:6ab421173406

Focus the button for the default action, if possible.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 17 Jan 2008 08:01:02 +0000
parents 4c28d1e4e284
children 04bdf1ff5d2a c85ee90ed861
files finch/gntrequest.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntrequest.c	Sun Jan 13 20:46:20 2008 +0000
+++ b/finch/gntrequest.c	Thu Jan 17 08:01:02 2008 +0000
@@ -253,7 +253,7 @@
 		void *user_data, size_t actioncount,
 		va_list actions)
 {
-	GntWidget *window, *box, *button;
+	GntWidget *window, *box, *button, *focus = NULL;
 	int i;
 
 	window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_ACTION);
@@ -272,9 +272,14 @@
 		g_object_set_data(G_OBJECT(button), "activate-userdata", user_data);
 		g_object_set_data(G_OBJECT(button), "activate-id", GINT_TO_POINTER(i));
 		g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(request_action_cb), window);
+
+		if (i == default_value)
+			focus = button;
 	}
 
 	gnt_widget_show(window);
+	if (focus)
+		gnt_box_give_focus_to_child(GNT_BOX(window), focus);
 
 	return window;
 }