diff --git a/libgimp/gimpproceduredialog.c b/libgimp/gimpproceduredialog.c index f14095dc00..ea336506cf 100644 --- a/libgimp/gimpproceduredialog.c +++ b/libgimp/gimpproceduredialog.c @@ -647,8 +647,8 @@ gimp_procedure_dialog_set_ok_label (GimpProcedureDialog *dialog, * * %GIMP_TYPE_LABEL_ENTRY (default): an entry with a label. * * %GTK_TYPE_ENTRY: an entry with no label. * * %GTK_TYPE_TEXT_VIEW: a text view with no label. - * - %GIMP_TYPE_CHOICE: - * * %GTK_TYPE_COMBO_BOX (default): a combo box displaying every + * - %GIMP_TYPE_CHOICE (default will depend on the number of choices): + * * %GTK_TYPE_COMBO_BOX: a combo box displaying every * choice. * * %GIMP_TYPE_INT_RADIO_FRAME: a frame with radio buttons. * - %GEGL_TYPE_COLOR: @@ -857,14 +857,28 @@ gimp_procedure_dialog_get_widget (GimpProcedureDialog *dialog, } else if (G_PARAM_SPEC_TYPE (pspec) == GIMP_TYPE_PARAM_CHOICE) { - if (widget_type == G_TYPE_NONE || widget_type == GTK_TYPE_COMBO_BOX) + GType real_widget_type = widget_type; + + if (real_widget_type == G_TYPE_NONE) + { + GimpChoice *choice = gimp_param_spec_choice_get_choice (pspec); + gint n_choices; + + n_choices = g_list_length (gimp_choice_list_nicks (choice)); + if (n_choices > 3) + real_widget_type = GTK_TYPE_COMBO_BOX; + else + real_widget_type = GIMP_TYPE_INT_RADIO_FRAME; + } + + if (real_widget_type == GTK_TYPE_COMBO_BOX) { widget = gimp_prop_choice_combo_box_new (G_OBJECT (priv->config), property); gtk_widget_set_vexpand (widget, FALSE); gtk_widget_set_hexpand (widget, TRUE); widget = gimp_label_string_widget_new (g_param_spec_get_nick (pspec), widget); } - else if (widget_type == GIMP_TYPE_INT_RADIO_FRAME) + else if (real_widget_type == GIMP_TYPE_INT_RADIO_FRAME) { widget = gimp_prop_choice_radio_frame_new (G_OBJECT (priv->config), property); gtk_widget_set_vexpand (widget, FALSE);