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

52 lines
1.2 KiB
Vala
Raw Permalink Normal View History

2020-08-01 23:47:22 +02:00
using Gtk;
public class Tootle.Widgets.Conversation : Widgets.Status {
public API.Conversation conversation { get; construct set; }
public Conversation (API.Conversation entity) {
Object (conversation: entity, status: entity.last_status);
conversation.bind_property ("unread", this.indicator, "visible", BindingFlags.SYNC_CREATE);
2021-07-23 13:41:03 +02:00
// this.indicators.child_set_property (this.indicator, "position", 2);
2020-08-01 23:47:22 +02:00
this.indicator.opacity = 1;
2021-07-23 13:41:03 +02:00
this.indicator.icon_name = "software-update-urgent-symbolic";
2020-08-01 23:47:22 +02:00
this.actions.destroy ();
}
public new string title_text {
owned get {
var label = "";
foreach (API.Account account in conversation.accounts) {
label += account.display_name;
2020-08-01 23:47:22 +02:00
if (conversation.accounts.last () != account)
label += ", ";
}
2020-10-24 05:42:24 +02:00
return label;
2020-08-01 23:47:22 +02:00
}
}
public new string subtitle_text {
owned get {
var label = "";
foreach (API.Account account in conversation.accounts) {
label += account.handle + " ";
}
2020-10-24 05:42:24 +02:00
return label;
2020-08-01 23:47:22 +02:00
}
}
public new string? avatar_url {
owned get {
if (conversation.accounts.size > 1)
return null;
else
return conversation.accounts.get (0).avatar;
}
}
public override void on_open () {
conversation.open ();
}
}