diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-05-05 22:59:43 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-05-05 22:59:43 -0400 |
commit | 64591e0fbd57dd7e00caabe2f6b65367ca541034 (patch) | |
tree | 5da3938294aa8c7de911062fa4e03907017fc3c8 | |
parent | 73df127928a4c56afe42a60c54c65c8793598265 (diff) | |
download | gtk+-64591e0fbd57dd7e00caabe2f6b65367ca541034.tar.gz |
checkbutton: Make the child expandbox-layout-child-expand
This is the proper behavior for check buttons -
the indicator is fixed size, and the child takes
all the remaining space.
-rw-r--r-- | gtk/gtkcheckbutton.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index 0704a8fdfa..72a51bc737 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -172,6 +172,30 @@ gtk_check_button_get_property (GObject *object, } static void +gtk_check_button_notify (GObject *object, + GParamSpec *pspec) +{ + if (strcmp (pspec->name, "child") == 0) + { + GtkWidget *child; + + child = gtk_button_get_child (GTK_BUTTON (object)); + if (child) + { + GtkLayoutManager *layout; + GtkLayoutChild *layout_child; + + layout = gtk_widget_get_layout_manager (GTK_WIDGET (object)); + layout_child = gtk_layout_manager_get_layout_child (layout, child); + gtk_box_layout_child_set_expand (GTK_BOX_LAYOUT_CHILD (layout_child), TRUE); + } + } + + if (G_OBJECT_CLASS (gtk_check_button_parent_class)->notify) + G_OBJECT_CLASS (gtk_check_button_parent_class)->notify (object, pspec); +} + +static void gtk_check_button_class_init (GtkCheckButtonClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); @@ -180,6 +204,7 @@ gtk_check_button_class_init (GtkCheckButtonClass *class) object_class->finalize = gtk_check_button_finalize; object_class->set_property = gtk_check_button_set_property; object_class->get_property = gtk_check_button_get_property; + object_class->notify = gtk_check_button_notify; widget_class->state_flags_changed = gtk_check_button_state_flags_changed; |