mirror of
https://github.com/TakeV-Lambda/Tooth.git
synced 2024-09-27 13:13:20 +00:00
2461d49fff
'The level of transparency differs between regular and high contrast styles. As such, it’s highly recommended to be used instead of changing opacity manually.'
59 lines
1.4 KiB
Vala
59 lines
1.4 KiB
Vala
using Gtk;
|
|
|
|
public class Tooth.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, "icon_name", BindingFlags.SYNC_CREATE, (b, src, ref target) => {
|
|
if (src.get_boolean()) {
|
|
target.set_string ("tooth-mark-important-symbolic");
|
|
this.indicator.remove_css_class("dim-label");
|
|
} else {
|
|
target.set_string ("tooth-mail-symbolic");
|
|
this.indicator.add_css_class("dim-label");
|
|
}
|
|
return true;
|
|
});
|
|
// this.indicators.child_set_property (this.indicator, "position", 2);
|
|
this.actions.destroy ();
|
|
}
|
|
|
|
public new string title_text {
|
|
owned get {
|
|
var label = "";
|
|
foreach (API.Account account in conversation.accounts) {
|
|
label += account.display_name;
|
|
if (conversation.accounts.last () != account)
|
|
label += ", ";
|
|
}
|
|
return label;
|
|
}
|
|
}
|
|
|
|
public new string subtitle_text {
|
|
owned get {
|
|
var label = "";
|
|
foreach (API.Account account in conversation.accounts) {
|
|
label += account.handle + " ";
|
|
}
|
|
return label;
|
|
}
|
|
}
|
|
|
|
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 ();
|
|
}
|
|
|
|
}
|