libgimp: new GtkSizeGroup for widgets inside a container

All the widgets with label inside GimpProcedureDialog have same
GtkSizeGroup (dialog->priv->label_group), which result in wrong sizes of
widget if any of the label is long. In this commit, a new GtkSizeGroup
is made for each of the container, so that labels are aligned but size
of widget in one container do not affect size of widgets in other
containers.

For the widget not belonging to any of the container, default
GtkSizeGroup (dialog->priv->label_group) is used.
This commit is contained in:
Mayank Suman 2021-06-17 23:41:15 +05:30
parent d8062d1d77
commit c99ae3769f

View file

@ -1750,8 +1750,9 @@ gimp_procedure_dialog_fill_container_list (GimpProcedureDialog *dialog,
GtkContainer *container, GtkContainer *container,
GList *properties) GList *properties)
{ {
GList *iter; GList *iter;
gboolean free_properties = FALSE; gboolean free_properties = FALSE;
GtkSizeGroup *sz_group;
g_return_val_if_fail (container_id != NULL, NULL); g_return_val_if_fail (container_id != NULL, NULL);
g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL); g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL);
@ -1803,6 +1804,7 @@ gimp_procedure_dialog_fill_container_list (GimpProcedureDialog *dialog,
free_properties = TRUE; free_properties = TRUE;
} }
sz_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
for (iter = properties; iter; iter = iter->next) for (iter = properties; iter; iter = iter->next)
{ {
GtkWidget *widget; GtkWidget *widget;
@ -1816,6 +1818,12 @@ gimp_procedure_dialog_fill_container_list (GimpProcedureDialog *dialog,
*/ */
g_object_ref (widget); g_object_ref (widget);
gtk_container_add (container, widget); gtk_container_add (container, widget);
if (GIMP_IS_LABELED (widget))
{
GtkWidget *label = gimp_labeled_get_label (GIMP_LABELED (widget));
gtk_size_group_remove_widget (dialog->priv->label_group, label);
gtk_size_group_add_widget (sz_group, label);
}
gtk_widget_show (widget); gtk_widget_show (widget);
} }
} }