From: robxnano <91250-robxnano@users.noreply.gitlab.gnome.org> Date: Wed, 16 Nov 2022 18:07:20 +0000 (+0000) Subject: filechooser: Fix gtk_file_chooser_set_choice again X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~9^2~101^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=adc0264dac0a32451f4963b2011879f1421631e7;p=gtk4.git 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. --- 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; } }