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.
This commit is contained in:
robxnano 2022-11-16 18:07:20 +00:00
parent 2daea9e459
commit adc0264dac
No known key found for this signature in database
GPG Key ID: 0E26B375E2B7DC05

View File

@ -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;
}
}