From ca331e85efe2a74a6b9b5a5ff0fbcd10a36758ce Mon Sep 17 00:00:00 2001 From: Marvin W Date: Tue, 16 Jan 2018 16:17:42 +0100 Subject: Render avatar on demand --- main/src/ui/manage_accounts/account_row.vala | 4 ++-- main/src/ui/manage_accounts/dialog.vala | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'main/src/ui/manage_accounts') diff --git a/main/src/ui/manage_accounts/account_row.vala b/main/src/ui/manage_accounts/account_row.vala index 04fad66f..13a8857d 100644 --- a/main/src/ui/manage_accounts/account_row.vala +++ b/main/src/ui/manage_accounts/account_row.vala @@ -7,7 +7,7 @@ namespace Dino.Ui.ManageAccounts { [GtkTemplate (ui = "/im/dino/Dino/manage_accounts/account_row.ui")] public class AccountRow : Gtk.ListBoxRow { - [GtkChild] public Image image; + [GtkChild] public AvatarImage image; [GtkChild] public Label jid_label; [GtkChild] public Image icon; @@ -17,7 +17,7 @@ public class AccountRow : Gtk.ListBoxRow { public AccountRow(StreamInteractor stream_interactor, Account account) { this.stream_interactor = stream_interactor; this.account = account; - Util.image_set_from_scaled_pixbuf(image, (new AvatarGenerator(40, 40, image.scale_factor)).draw_account(stream_interactor, account)); + image.set_jid(stream_interactor, account.bare_jid, account); jid_label.set_label(account.bare_jid.to_string()); stream_interactor.connection_manager.connection_error.connect((account, error) => { diff --git a/main/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala index 6fb0c427..8f2b76a7 100644 --- a/main/src/ui/manage_accounts/dialog.vala +++ b/main/src/ui/manage_accounts/dialog.vala @@ -19,7 +19,7 @@ public class Dialog : Gtk.Dialog { [GtkChild] public Button no_accounts_add; [GtkChild] public ToolButton add_account_button; [GtkChild] public ToolButton remove_account_button; - [GtkChild] public Image image; + [GtkChild] public AvatarImage image; [GtkChild] public Button image_button; [GtkChild] public Label jid_label; [GtkChild] public Label state_label; @@ -185,14 +185,14 @@ public class Dialog : Gtk.Dialog { private void on_received_avatar(Pixbuf pixbuf, Jid jid, Account account) { if (selected_account.equals(account) && jid.equals(account.bare_jid)) { - Util.image_set_from_scaled_pixbuf(image, (new AvatarGenerator(50, 50, image.scale_factor)).draw_account(stream_interactor, account)); + image.set_jid(stream_interactor, account.bare_jid, account); } } private void populate_grid_data(Account account) { active_switch.state_set.disconnect(change_account_state); - Util.image_set_from_scaled_pixbuf(image, (new AvatarGenerator(50, 50, image.scale_factor)).draw_account(stream_interactor, account)); + image.set_jid(stream_interactor, account.bare_jid, account); active_switch.set_active(account.enabled); jid_label.label = account.bare_jid.to_string(); -- cgit v1.2.3-70-g09d2