diff options
author | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2021-09-18 00:17:36 -0300 |
---|---|---|
committer | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2021-09-18 00:22:05 -0300 |
commit | 02bb23486fa40e9a3e37097c2e1ca0a70ba193ab (patch) | |
tree | a43a205be244844a27ce7c83019521c3f9699194 | |
parent | bc0d9488eede6f71283cbef1f1a7ecc918065618 (diff) | |
download | gtk+-02bb23486fa40e9a3e37097c2e1ca0a70ba193ab.tar.gz |
filechooserwidget: Return an id in get_choice()
gtk_file_chooser_widget_get_choice() is supposed to return the option
id of the choice, but it currently is returning the option label.
Return the option id instead.
-rw-r--r-- | gtk/gtkfilechooserwidget.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 88e08c171b..a2310f35d8 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -8060,10 +8060,13 @@ gtk_file_chooser_widget_get_choice (GtkFileChooser *chooser, widget = (GtkWidget *)g_hash_table_lookup (impl->choices, id); if (GTK_IS_DROP_DOWN (widget)) { - gpointer selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (widget)); - if (GTK_IS_STRING_OBJECT (selected)) - return gtk_string_object_get_string (GTK_STRING_OBJECT (selected)); - return NULL; + const char **options; + guint selected; + + options = (const char **) g_object_get_data (G_OBJECT (widget), "options"); + selected = gtk_drop_down_get_selected (GTK_DROP_DOWN (widget)); + + return options[selected]; } else if (GTK_IS_CHECK_BUTTON (widget)) { |