[gimp] libgimp: new GtkSizeGroup for widgets inside a container
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: new GtkSizeGroup for widgets inside a container
- Date: Fri, 18 Jun 2021 12:52:25 +0000 (UTC)
commit c99ae3769f23b0e99c4ad9b77ec9835c60ae0f05
Author: Mayank Suman <mayanksuman live com>
Date: Thu Jun 17 23:41:15 2021 +0530
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.
libgimp/gimpproceduredialog.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/libgimp/gimpproceduredialog.c b/libgimp/gimpproceduredialog.c
index de8257f30a..487b48cf96 100644
--- a/libgimp/gimpproceduredialog.c
+++ b/libgimp/gimpproceduredialog.c
@@ -1750,8 +1750,9 @@ gimp_procedure_dialog_fill_container_list (GimpProcedureDialog *dialog,
GtkContainer *container,
GList *properties)
{
- GList *iter;
- gboolean free_properties = FALSE;
+ GList *iter;
+ gboolean free_properties = FALSE;
+ GtkSizeGroup *sz_group;
g_return_val_if_fail (container_id != NULL, 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;
}
+ sz_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
for (iter = properties; iter; iter = iter->next)
{
GtkWidget *widget;
@@ -1816,6 +1818,12 @@ gimp_procedure_dialog_fill_container_list (GimpProcedureDialog *dialog,
*/
g_object_ref (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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]