[gtk+/gtk-2-16] Bug 592606 - Activate the default button in a respose-request callback



commit c7dac07222b3188674156fff1dae36615568758d
Author: Benjamin Otte <otte gnome org>
Date:   Fri Aug 21 19:02:38 2009 +0200

    Bug 592606 - Activate the default button in a respose-request callback
    
    Previously the rightmost button with a proper response id was activated,
    this is now only done if there is no default button set.
    
    With this patch the right widget gets activated when there are multiple
    widgets wth response ids conforming to is_stock_accept_response_id() as
    the selected widget is made the new default widget before showing the
    overwrite confirmation dialog.

 gtk/gtkfilechooserdialog.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c
index cfa836d..9827e7b 100644
--- a/gtk/gtkfilechooserdialog.c
+++ b/gtk/gtkfilechooserdialog.c
@@ -225,6 +225,11 @@ file_chooser_widget_response_requested (GtkWidget            *widget,
 {
   GList *children, *l;
 
+  dialog->priv->response_requested = TRUE;
+
+  if (gtk_window_activate_default (GTK_WINDOW (dialog)))
+    return;
+
   /* There probably isn't a default widget, so make things easier for the
    * programmer by looking for a reasonable button on our own.
    */
@@ -240,12 +245,14 @@ file_chooser_widget_response_requested (GtkWidget            *widget,
       response_id = gtk_dialog_get_response_for_widget (GTK_DIALOG (dialog), widget);
       if (is_stock_accept_response_id (response_id))
 	{
-	  dialog->priv->response_requested = TRUE;
 	  gtk_widget_activate (widget); /* Should we gtk_dialog_response (dialog, response_id) instead? */
 	  break;
 	}
     }
 
+  if (l == NULL)
+    dialog->priv->response_requested = FALSE;
+
   g_list_free (children);
 }
   



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]