[gtk/box-layout-child-expand] spinbutton: Use the layout expand flag
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/box-layout-child-expand] spinbutton: Use the layout expand flag
- Date: Wed, 6 May 2020 03:04:55 +0000 (UTC)
commit 73df127928a4c56afe42a60c54c65c8793598265
Author: Matthias Clasen <mclasen redhat com>
Date: Tue May 5 22:39:12 2020 -0400
spinbutton: Use the layout expand flag
It does not make a difference in practice here,
since we don't propagate expand flags from the text
to the spin button, but we can just as well use
the layout expand flag here.
gtk/gtkspinbutton.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 0c790a6fff..819db58432 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -906,6 +906,8 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
{
GtkEventController *controller;
GtkGesture *gesture;
+ GtkLayoutManager *layout;
+ GtkLayoutChild *child;
spin_button->adjustment = NULL;
spin_button->timer = 0;
@@ -928,11 +930,13 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
gtk_editable_init_delegate (GTK_EDITABLE (spin_button));
gtk_editable_set_width_chars (GTK_EDITABLE (spin_button->entry), 0);
gtk_editable_set_max_width_chars (GTK_EDITABLE (spin_button->entry), 0);
- gtk_widget_set_hexpand (spin_button->entry, TRUE);
- gtk_widget_set_vexpand (spin_button->entry, TRUE);
g_signal_connect (spin_button->entry, "activate", G_CALLBACK (gtk_spin_button_activate), spin_button);
gtk_widget_set_parent (spin_button->entry, GTK_WIDGET (spin_button));
+ layout = gtk_widget_get_layout_manager (GTK_WIDGET (spin_button));
+ child = gtk_layout_manager_get_layout_child (layout, spin_button->entry);
+ gtk_box_layout_child_set_expand (GTK_BOX_LAYOUT_CHILD (child), TRUE);
+
spin_button->down_button = gtk_button_new_from_icon_name ("value-decrease-symbolic");
gtk_widget_add_css_class (spin_button->down_button, "down");
gtk_widget_set_can_focus (spin_button->down_button, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]