summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAylur <[email protected]>2024-07-27 13:52:29 +0200
committerAylur <[email protected]>2024-07-27 13:52:29 +0200
commitcf2260d5a8d4163f451029b53327cbe3b6ee73ab (patch)
treed677248316abc8e482ff1faae496ca66ff7fec17 /src
parent22132efcdeb08569cc27ca5414a0bb47511872d6 (diff)
add: Label widget
Diffstat (limited to 'src')
-rw-r--r--src/meson.build1
-rw-r--r--src/widget/label.vala18
2 files changed, 19 insertions, 0 deletions
diff --git a/src/meson.build b/src/meson.build
index 0bc73a1..0dac152 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -33,6 +33,7 @@ sources = [
# 'widget/circularprogress.vala', # TODO: math lib -X -lm
'widget/eventbox.vala',
'widget/icon.vala',
+ 'widget/label.vala',
'widget/levelbar.vala',
'widget/overlay.vala',
'widget/scrollable.vala',
diff --git a/src/widget/label.vala b/src/widget/label.vala
new file mode 100644
index 0000000..4063b6f
--- /dev/null
+++ b/src/widget/label.vala
@@ -0,0 +1,18 @@
+using Pango;
+
+public class Astal.Label : Gtk.Label {
+ public bool truncate {
+ set { ellipsize = value ? EllipsizeMode.END : EllipsizeMode.NONE; }
+ get { return ellipsize == EllipsizeMode.END; }
+ }
+
+ 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"));
+ }
+}