summaryrefslogtreecommitdiff
path: root/src/components/channellist/classic/guildlist.cpp
blob: 0d5737b4fe58acd5b0ff2dd1772ede6ac80e8c1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "guildlist.hpp"
#include "guildlistfolderitem.hpp"

GuildList::GuildList() {
    set_selection_mode(Gtk::SELECTION_NONE);
    show_all_children();
}

void GuildList::AddGuild(Snowflake id) {
    const auto guild = Abaddon::Get().GetDiscordClient().GetGuild(id);
    if (!guild.has_value()) return;

    auto *item = Gtk::make_managed<GuildListGuildItem>(*guild);
    item->show();
    add(*item);
}

void GuildList::Clear() {
    const auto children = get_children();
    for (auto child : children) {
        delete child;
    }
}