anotherim-desktop/main/src/ui/manage_accounts/account_row.vala

42 lines
1.3 KiB
Vala
Raw Normal View History

2017-03-02 14:37:32 +00:00
using Gtk;
using Dino.Entities;
namespace Dino.Ui.ManageAccounts {
[GtkTemplate (ui = "/im/dino/Dino/manage_accounts/account_row.ui")]
2017-03-02 14:37:32 +00:00
public class AccountRow : Gtk.ListBoxRow {
2018-01-16 15:17:42 +00:00
[GtkChild] public AvatarImage image;
2017-03-10 17:07:28 +00:00
[GtkChild] public Label jid_label;
[GtkChild] public Image icon;
2017-03-02 14:37:32 +00:00
public Account account;
private StreamInteractor stream_interactor;
2017-03-02 14:37:32 +00:00
public AccountRow(StreamInteractor stream_interactor, Account account) {
this.stream_interactor = stream_interactor;
2017-03-02 14:37:32 +00:00
this.account = account;
image.set_conversation(stream_interactor, new Conversation(account.bare_jid, account, Conversation.Type.CHAT));
2017-03-02 14:37:32 +00:00
jid_label.set_label(account.bare_jid.to_string());
stream_interactor.connection_manager.connection_error.connect((account, error) => {
2017-11-11 20:29:13 +00:00
if (account.equals(this.account)) {
update_warning_icon();
}
});
stream_interactor.connection_manager.connection_state_changed.connect((account, state) => {
2017-11-11 20:29:13 +00:00
if (account.equals(this.account)) {
update_warning_icon();
}
});
}
private void update_warning_icon() {
ConnectionManager.ConnectionError? error = stream_interactor.connection_manager.get_error(account);
icon.visible = (error != null);
2017-03-02 14:37:32 +00:00
}
}
2017-03-10 17:07:28 +00:00
2017-08-17 19:24:01 +00:00
}