diff options
author | kotontrion <[email protected]> | 2024-10-29 13:50:41 +0100 |
---|---|---|
committer | kotontrion <[email protected]> | 2024-10-29 13:50:41 +0100 |
commit | 57f20666e716fde56579b8aa638eed1264f793de (patch) | |
tree | 59b2ebbd770c80049cea4df82109d28f617675fe /lib/astal/gtk3/src/widget/label.vala | |
parent | 4d9ae88b0bab75779876d465f986791d052414ca (diff) | |
parent | 7e484188e7492ac7945c854bcc3f26cec1863c91 (diff) |
Merge branch 'main' into feat/cava
Diffstat (limited to 'lib/astal/gtk3/src/widget/label.vala')
-rw-r--r-- | lib/astal/gtk3/src/widget/label.vala | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/astal/gtk3/src/widget/label.vala b/lib/astal/gtk3/src/widget/label.vala new file mode 100644 index 0000000..899cba9 --- /dev/null +++ b/lib/astal/gtk3/src/widget/label.vala @@ -0,0 +1,24 @@ +using Pango; + +public class Astal.Label : Gtk.Label { + /** + * Shortcut for setting [[email protected]:ellipsize] to [[email protected]] + */ + public bool truncate { + set { ellipsize = value ? EllipsizeMode.END : EllipsizeMode.NONE; } + get { return ellipsize == EllipsizeMode.END; } + } + + /** + * Shortcut for setting [[email protected]:justify] to [[email protected]] + */ + public new bool justify_fill { + set { justify = value ? Gtk.Justification.FILL : Gtk.Justification.LEFT; } + get { return justify == Gtk.Justification.FILL; } + } + + construct { + notify["ellipsize"].connect(() => notify_property("truncate")); + notify["justify"].connect(() => notify_property("justify_fill")); + } +} |