diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-06-11 01:24:23 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-06-11 01:24:23 -0400 |
commit | e166c83d33bbf5aebe172111c8a7614c1dece48c (patch) | |
tree | deb06cefbda7fe9f08aae54daaa2eeb9ec659807 /windows/pinnedwindow.cpp | |
parent | efc97aa2b0d7a4d63a2e6219070919559a0cf64d (diff) | |
download | abaddon-portaudio-e166c83d33bbf5aebe172111c8a7614c1dece48c.tar.gz abaddon-portaudio-e166c83d33bbf5aebe172111c8a7614c1dece48c.zip |
basic pins window
Diffstat (limited to 'windows/pinnedwindow.cpp')
-rw-r--r-- | windows/pinnedwindow.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/windows/pinnedwindow.cpp b/windows/pinnedwindow.cpp new file mode 100644 index 0000000..0d677ee --- /dev/null +++ b/windows/pinnedwindow.cpp @@ -0,0 +1,32 @@ +#include "pinnedwindow.hpp" +#include "../abaddon.hpp" + +PinnedWindow::PinnedWindow(const ChannelData &data) + : ChannelID(data.ID) { + if (data.GuildID.has_value()) + GuildID = *data.GuildID; + + set_name("pinned-messages"); + set_default_size(450, 375); + set_title("#" + *data.Name + " - Pinned Messages"); + set_position(Gtk::WIN_POS_CENTER); + get_style_context()->add_class("app-window"); + get_style_context()->add_class("app-popup"); + get_style_context()->add_class("pinned-messages-window"); + + add(m_chat); + m_chat.show(); + + m_chat.SetActiveChannel(ChannelID); + + FetchPinned(); +} + +void PinnedWindow::FetchPinned() { + Abaddon::Get().GetDiscordClient().FetchPinned(ChannelID, sigc::mem_fun(*this, &PinnedWindow::OnFetchedPinned)); +} + +void PinnedWindow::OnFetchedPinned(const std::vector<Message> &msgs, DiscordError code) { + if (code != DiscordError::NONE) return; + m_chat.SetMessages(msgs.begin(), msgs.end()); +} |