Skip to content

Commit

Permalink
feat(status): simplify layout (#1299)
Browse files Browse the repository at this point in the history
Mark the wrappable label hexpand, and use xalign to align the text to
the left -- this is just like what spoiler_label_rev already does. This
now hits the fast path introduced in https://gitlab.gnome.org/GNOME/gtk/-/commit/4150f2d3d255b90d4c28bb08d186153a97a3d3fb,
avoiding measuring the label width-for-height.

The header_button ("%s boosted", "in reply to %s") already has halign
set to start. Also give it valign of center. This should not change
anything about the resulting layout at all, since the label is always
allocated exactly its natural height (same as minimum height), but since
https://gitlab.gnome.org/GNOME/gtk/-/commit/16911e183ca12c441bc6bbbb650f63e25f02016e
GTK will in this case horizontally align for the overall natural width
rather than for the natural width for allocated height; thus we avoid
measuring the label width-for-height. But note that this is not in any
way a guarantee, we just exploit a specific aspect of GTK behavior here.

Signed-off-by: Sergey Bugaev <[email protected]>
  • Loading branch information
bugaevc authored Dec 28, 2024
1 parent e58fa4f commit 316ec29
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions data/ui/widgets/status.ui
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
<object class="GtkButton" id="header_button">
<property name="visible">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<child>
<object class="TubaWidgetsRichLabel" id="header_label">
<property name="use_markup">0</property>
Expand Down Expand Up @@ -299,6 +300,8 @@
<property name="label">Spoiler Text Here</property>
<property name="wrap">1</property>
<property name="wrap-mode">word-char</property>
<property name="hexpand">1</property>
<property name="xalign">0</property>
</object>
</child>
</object>
Expand Down

0 comments on commit 316ec29

Please sign in to comment.