Tooth/src/Widgets/Notification.vala

28 lines
728 B
Vala
Raw Normal View History

2018-04-17 12:01:55 +00:00
using Gtk;
2020-05-29 12:19:35 +00:00
public class Tootle.Widgets.Notification : Widgets.Status {
2019-03-07 16:16:52 +00:00
2020-05-29 12:19:35 +00:00
public API.Notification notification { get; construct set; }
2018-04-17 12:01:55 +00:00
2020-05-29 12:19:35 +00:00
public Notification (API.Notification obj) {
API.Status status;
if (obj.status != null)
status = obj.status;
else
status = new API.Status.from_account (obj.account);
2018-04-17 12:01:55 +00:00
2020-05-29 12:19:35 +00:00
Object (notification: obj, status: status);
this.kind = obj.kind;
2018-04-17 12:01:55 +00:00
}
2020-05-29 12:19:35 +00:00
protected override void on_kind_changed () {
if (kind == null)
return;
2019-03-07 16:16:52 +00:00
2020-05-29 12:19:35 +00:00
header_icon.visible = header_label.visible = true;
header_icon.icon_name = kind.get_icon ();
header_label.label = kind.get_desc (notification.account);
2018-04-17 12:10:57 +00:00
}
2019-03-07 16:16:52 +00:00
2018-04-17 12:01:55 +00:00
}