]> Pileus Git - ~andy/gtk/commitdiff
Bug 592606 - Activate the default button in a respose-request callback
authorBenjamin Otte <otte@gnome.org>
Fri, 21 Aug 2009 17:02:38 +0000 (19:02 +0200)
committerBenjamin Otte <otte@gnome.org>
Thu, 27 Aug 2009 09:51:43 +0000 (11:51 +0200)
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

index 0868691e22af7905130b9826726dbc1213cbad88..2dd3737154254921600bfa8e37bb0e8c184ab1f9 100644 (file)
@@ -224,6 +224,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.
    */
@@ -239,12 +244,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);
 }