aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/occupant_menu/list_row.vala
blob: 762c281b9f94cd59affeafa37e3c19cbf23324e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using Gtk;

using Dino.Entities;
using Xmpp;

namespace Dino.Ui.OccupantMenu {

[GtkTemplate (ui = "/im/dino/Dino/occupant_list_item.ui")]
public class ListRow : ListBoxRow {

    [GtkChild] private Image image;
    [GtkChild] public Label name_label;

    public Account? account;
    public Jid? jid;

    public ListRow(StreamInteractor stream_interactor, Account account, Jid jid) {
        this.account = account;
        this.jid = jid;

        name_label.label = Util.get_display_name(stream_interactor, jid, account);
        Util.image_set_from_scaled_pixbuf(image, (new AvatarGenerator(30, 30, image.scale_factor)).draw_jid(stream_interactor, jid, account));
    }

    public ListRow.label(string c, string text) {
        name_label.label = text;
        image.set_from_pixbuf((new AvatarGenerator(30, 30, 1)).set_greyscale(true).draw_text(c)); // why 1
    }
}

}