summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkotontrion <[email protected]>2024-09-02 09:39:07 +0200
committerGitHub <[email protected]>2024-09-02 09:39:07 +0200
commit292723065d5f6f742d11bec3498ef60b33979daa (patch)
treea71bfae2b13a3d61800e622fab4e6ff82fdb0f02
parent8da6a2174296bc1b78c6dde13f6bca46e67e156a (diff)
core: add g_icon property to icon widget (#2)
-rw-r--r--core/src/widget/icon.vala12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/src/widget/icon.vala b/core/src/widget/icon.vala
index ef43baf..ccd20f3 100644
--- a/core/src/widget/icon.vala
+++ b/core/src/widget/icon.vala
@@ -10,6 +10,7 @@ public class Icon : Gtk.Image {
public new Gdk.Pixbuf pixbuf { get; set; }
public string icon { get; set; default = ""; }
+ public GLib.Icon g_icon {get; set;}
private async void display_icon() {
switch(type) {
@@ -45,6 +46,11 @@ public class Icon : Gtk.Image {
set_from_surface(cs);
}
break;
+ case IconType.GICON:
+ pixel_size = (int)size;
+ gicon = g_icon;
+ break;
+
}
}
@@ -71,6 +77,11 @@ public class Icon : Gtk.Image {
display_icon.begin();
});
+ notify["g-icon"].connect(() => {
+ type = IconType.GICON;
+ display_icon.begin();
+ });
+
size_allocate.connect(() => {
size = get_style_context()
.get_property("font-size", Gtk.StateFlags.NORMAL).get_double();
@@ -91,5 +102,6 @@ private enum IconType {
NAMED,
FILE,
PIXBUF,
+ GICON,
}
}