tootle-linux-client/src/Widgets/Notification.vala

28 lines
728 B
Vala
Raw Normal View History

2018-04-17 14:01:55 +02:00
using Gtk;
2020-05-29 14:19:35 +02:00
public class Tootle.Widgets.Notification : Widgets.Status {
2019-03-07 17:16:52 +01:00
2020-05-29 14:19:35 +02:00
public API.Notification notification { get; construct set; }
2018-04-17 14:01:55 +02:00
2020-05-29 14:19:35 +02: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 14:01:55 +02:00
2020-05-29 14:19:35 +02:00
Object (notification: obj, status: status);
this.kind = obj.kind;
2018-04-17 14:01:55 +02:00
}
2020-05-29 14:19:35 +02:00
protected override void on_kind_changed () {
if (kind == null)
return;
2019-03-07 17:16:52 +01:00
2020-05-29 14:19:35 +02: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 14:10:57 +02:00
}
2019-03-07 17:16:52 +01:00
2018-04-17 14:01:55 +02:00
}