mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-15 05:00:09 +00:00
file chooser: Stop using gtk_window_activate_default
Instead, use the new way of activating default. I think most of the default handling in GtkFileChooserDialog should be dropped, but for now this keeps things working.
This commit is contained in:
parent
0ae71cacb4
commit
3d1fdf77dc
@ -341,17 +341,7 @@ static void
|
||||
file_chooser_widget_file_activated (GtkFileChooser *chooser,
|
||||
GtkFileChooserDialog *dialog)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
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.
|
||||
*/
|
||||
widget = get_accept_action_widget (GTK_DIALOG (dialog), TRUE);
|
||||
if (widget)
|
||||
gtk_widget_activate (widget);
|
||||
gtk_widget_activate_default (GTK_WIDGET (chooser));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -405,22 +395,9 @@ static void
|
||||
file_chooser_widget_response_requested (GtkWidget *widget,
|
||||
GtkFileChooserDialog *dialog)
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
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.
|
||||
*/
|
||||
button = get_accept_action_widget (GTK_DIALOG (dialog), TRUE);
|
||||
if (button)
|
||||
{
|
||||
gtk_widget_activate (button);
|
||||
return;
|
||||
}
|
||||
gtk_widget_activate_default (widget);
|
||||
|
||||
dialog->priv->response_requested = FALSE;
|
||||
}
|
||||
|
@ -1347,25 +1347,8 @@ key_press_cb (GtkEventControllerKey *controller,
|
||||
&& !(priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (impl);
|
||||
GtkWindow *window;
|
||||
|
||||
window = get_toplevel (widget);
|
||||
if (window)
|
||||
{
|
||||
GtkWidget *default_widget, *focus_widget;
|
||||
|
||||
default_widget = gtk_window_get_default_widget (window);
|
||||
focus_widget = gtk_root_get_focus (GTK_ROOT (window));
|
||||
|
||||
if (widget != default_widget &&
|
||||
!(widget == focus_widget && (!default_widget || !gtk_widget_get_sensitive (default_widget))))
|
||||
{
|
||||
gtk_window_activate_default (window);
|
||||
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
}
|
||||
gtk_widget_activate_default (GTK_WIDGET (impl));
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
|
||||
if (keyval == GDK_KEY_Escape &&
|
||||
|
Loading…
Reference in New Issue
Block a user