From adc0264dac0a32451f4963b2011879f1421631e7 Mon Sep 17 00:00:00 2001 From: robxnano <91250-robxnano@users.noreply.gitlab.gnome.org> Date: Wed, 16 Nov 2022 18:07:20 +0000 Subject: [PATCH] filechooser: Fix gtk_file_chooser_set_choice again If the choice was in the form of a GtkDropDown, the code failed to find the widget and so the choice never got set. Fixes #5346. --- gtk/gtkfilechooserwidget.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 20a8f4abb2..c2b29a2034 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -7360,20 +7360,17 @@ gtk_file_chooser_widget_set_choice (GtkFileChooser *chooser, widget = (GtkWidget *)g_hash_table_lookup (impl->choices, id); - if (GTK_IS_BOX (widget)) + if (GTK_IS_DROP_DOWN (widget)) { guint i; const char **options; - GtkWidget *dropdown; - - dropdown = gtk_widget_get_last_child (widget); - options = (const char **) g_object_get_data (G_OBJECT (dropdown), "options"); + options = (const char **) g_object_get_data (G_OBJECT (widget), "options"); for (i = 0; options[i]; i++) { if (strcmp (option, options[i]) == 0) { - gtk_drop_down_set_selected (GTK_DROP_DOWN (dropdown), i); + gtk_drop_down_set_selected (GTK_DROP_DOWN (widget), i); break; } } -- 2.30.2