forked from OpenGamers/abaddon
let channel list manage itself instead of window
This commit is contained in:
30
abaddon.cpp
30
abaddon.cpp
@@ -35,12 +35,6 @@ Abaddon::Abaddon()
|
|||||||
m_discord.signal_message_delete().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnMessageDelete));
|
m_discord.signal_message_delete().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnMessageDelete));
|
||||||
m_discord.signal_message_update().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnMessageUpdate));
|
m_discord.signal_message_update().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnMessageUpdate));
|
||||||
m_discord.signal_guild_member_list_update().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnGuildMemberListUpdate));
|
m_discord.signal_guild_member_list_update().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnGuildMemberListUpdate));
|
||||||
m_discord.signal_guild_create().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnGuildCreate));
|
|
||||||
m_discord.signal_guild_delete().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnGuildDelete));
|
|
||||||
m_discord.signal_channel_delete().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnChannelDelete));
|
|
||||||
m_discord.signal_channel_update().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnChannelUpdate));
|
|
||||||
m_discord.signal_channel_create().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnChannelCreate));
|
|
||||||
m_discord.signal_guild_update().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnGuildUpdate));
|
|
||||||
m_discord.signal_reaction_add().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnReactionAdd));
|
m_discord.signal_reaction_add().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnReactionAdd));
|
||||||
m_discord.signal_reaction_remove().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnReactionRemove));
|
m_discord.signal_reaction_remove().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnReactionRemove));
|
||||||
m_discord.signal_guild_join_request_create().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnGuildJoinRequestCreate));
|
m_discord.signal_guild_join_request_create().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnGuildJoinRequestCreate));
|
||||||
@@ -196,30 +190,6 @@ void Abaddon::DiscordOnGuildMemberListUpdate(Snowflake guild_id) {
|
|||||||
m_main_window->UpdateMembers();
|
m_main_window->UpdateMembers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Abaddon::DiscordOnGuildCreate(const GuildData &guild) {
|
|
||||||
m_main_window->UpdateChannelsNewGuild(guild.ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Abaddon::DiscordOnGuildDelete(Snowflake guild_id) {
|
|
||||||
m_main_window->UpdateChannelsRemoveGuild(guild_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Abaddon::DiscordOnChannelDelete(Snowflake channel_id) {
|
|
||||||
m_main_window->UpdateChannelsRemoveChannel(channel_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Abaddon::DiscordOnChannelUpdate(Snowflake channel_id) {
|
|
||||||
m_main_window->UpdateChannelsUpdateChannel(channel_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Abaddon::DiscordOnChannelCreate(Snowflake channel_id) {
|
|
||||||
m_main_window->UpdateChannelsCreateChannel(channel_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Abaddon::DiscordOnGuildUpdate(Snowflake guild_id) {
|
|
||||||
m_main_window->UpdateChannelsUpdateGuild(guild_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Abaddon::DiscordOnReactionAdd(Snowflake message_id, const Glib::ustring ¶m) {
|
void Abaddon::DiscordOnReactionAdd(Snowflake message_id, const Glib::ustring ¶m) {
|
||||||
m_main_window->UpdateChatReactionAdd(message_id, param);
|
m_main_window->UpdateChatReactionAdd(message_id, param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,12 +65,6 @@ public:
|
|||||||
void DiscordOnMessageDelete(Snowflake id, Snowflake channel_id);
|
void DiscordOnMessageDelete(Snowflake id, Snowflake channel_id);
|
||||||
void DiscordOnMessageUpdate(Snowflake id, Snowflake channel_id);
|
void DiscordOnMessageUpdate(Snowflake id, Snowflake channel_id);
|
||||||
void DiscordOnGuildMemberListUpdate(Snowflake guild_id);
|
void DiscordOnGuildMemberListUpdate(Snowflake guild_id);
|
||||||
void DiscordOnGuildCreate(const GuildData &guild);
|
|
||||||
void DiscordOnGuildDelete(Snowflake guild_id);
|
|
||||||
void DiscordOnChannelDelete(Snowflake channel_id);
|
|
||||||
void DiscordOnChannelUpdate(Snowflake channel_id);
|
|
||||||
void DiscordOnChannelCreate(Snowflake channel_id);
|
|
||||||
void DiscordOnGuildUpdate(Snowflake guild_id);
|
|
||||||
void DiscordOnReactionAdd(Snowflake message_id, const Glib::ustring ¶m);
|
void DiscordOnReactionAdd(Snowflake message_id, const Glib::ustring ¶m);
|
||||||
void DiscordOnReactionRemove(Snowflake message_id, const Glib::ustring ¶m);
|
void DiscordOnReactionRemove(Snowflake message_id, const Glib::ustring ¶m);
|
||||||
void DiscordOnGuildJoinRequestCreate(const GuildJoinRequestCreateData &data);
|
void DiscordOnGuildJoinRequestCreate(const GuildJoinRequestCreateData &data);
|
||||||
|
|||||||
@@ -116,7 +116,14 @@ ChannelList::ChannelList()
|
|||||||
m_menu_dm.append(m_menu_dm_close);
|
m_menu_dm.append(m_menu_dm_close);
|
||||||
m_menu_dm.show_all();
|
m_menu_dm.show_all();
|
||||||
|
|
||||||
Abaddon::Get().GetDiscordClient().signal_message_create().connect(sigc::mem_fun(*this, &ChannelList::OnMessageCreate));
|
auto &discord = Abaddon::Get().GetDiscordClient();
|
||||||
|
discord.signal_message_create().connect(sigc::mem_fun(*this, &ChannelList::OnMessageCreate));
|
||||||
|
discord.signal_guild_create().connect(sigc::mem_fun(*this, &ChannelList::UpdateNewGuild));
|
||||||
|
discord.signal_guild_delete().connect(sigc::mem_fun(*this, &ChannelList::UpdateRemoveGuild));
|
||||||
|
discord.signal_channel_delete().connect(sigc::mem_fun(*this, &ChannelList::UpdateRemoveChannel));
|
||||||
|
discord.signal_channel_update().connect(sigc::mem_fun(*this, &ChannelList::UpdateChannel));
|
||||||
|
discord.signal_channel_create().connect(sigc::mem_fun(*this, &ChannelList::UpdateCreateChannel));
|
||||||
|
discord.signal_guild_update().connect(sigc::mem_fun(*this, &ChannelList::UpdateGuild));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelList::UpdateListing() {
|
void ChannelList::UpdateListing() {
|
||||||
@@ -142,13 +149,10 @@ void ChannelList::UpdateListing() {
|
|||||||
AddPrivateChannels();
|
AddPrivateChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelList::UpdateNewGuild(Snowflake id) {
|
void ChannelList::UpdateNewGuild(const GuildData &guild) {
|
||||||
const auto guild = Abaddon::Get().GetDiscordClient().GetGuild(id);
|
|
||||||
auto &img = Abaddon::Get().GetImageManager();
|
auto &img = Abaddon::Get().GetImageManager();
|
||||||
|
|
||||||
if (!guild.has_value()) return;
|
auto iter = AddGuild(guild);
|
||||||
|
|
||||||
auto iter = AddGuild(*guild);
|
|
||||||
|
|
||||||
// update sort order
|
// update sort order
|
||||||
int sortnum = 0;
|
int sortnum = 0;
|
||||||
|
|||||||
@@ -118,17 +118,18 @@ private:
|
|||||||
class ChannelList : public Gtk::ScrolledWindow {
|
class ChannelList : public Gtk::ScrolledWindow {
|
||||||
public:
|
public:
|
||||||
ChannelList();
|
ChannelList();
|
||||||
|
|
||||||
void UpdateListing();
|
void UpdateListing();
|
||||||
void UpdateNewGuild(Snowflake id);
|
void SetActiveChannel(Snowflake id);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void UpdateNewGuild(const GuildData &guild);
|
||||||
void UpdateRemoveGuild(Snowflake id);
|
void UpdateRemoveGuild(Snowflake id);
|
||||||
void UpdateRemoveChannel(Snowflake id);
|
void UpdateRemoveChannel(Snowflake id);
|
||||||
void UpdateChannel(Snowflake id);
|
void UpdateChannel(Snowflake id);
|
||||||
void UpdateCreateChannel(Snowflake id);
|
void UpdateCreateChannel(Snowflake id);
|
||||||
void UpdateGuild(Snowflake id);
|
void UpdateGuild(Snowflake id);
|
||||||
|
|
||||||
void SetActiveChannel(Snowflake id);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Gtk::TreeView m_view;
|
Gtk::TreeView m_view;
|
||||||
|
|
||||||
class ModelColumns : public Gtk::TreeModel::ColumnRecord {
|
class ModelColumns : public Gtk::TreeModel::ColumnRecord {
|
||||||
|
|||||||
@@ -165,30 +165,6 @@ void MainWindow::UpdateChannelListing() {
|
|||||||
m_channel_list.UpdateListing();
|
m_channel_list.UpdateListing();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::UpdateChannelsNewGuild(Snowflake id) {
|
|
||||||
m_channel_list.UpdateNewGuild(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::UpdateChannelsRemoveGuild(Snowflake id) {
|
|
||||||
m_channel_list.UpdateRemoveGuild(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::UpdateChannelsRemoveChannel(Snowflake id) {
|
|
||||||
m_channel_list.UpdateRemoveChannel(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::UpdateChannelsUpdateChannel(Snowflake id) {
|
|
||||||
m_channel_list.UpdateChannel(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::UpdateChannelsCreateChannel(Snowflake id) {
|
|
||||||
m_channel_list.UpdateCreateChannel(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::UpdateChannelsUpdateGuild(Snowflake id) {
|
|
||||||
m_channel_list.UpdateGuild(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::UpdateChatWindowContents() {
|
void MainWindow::UpdateChatWindowContents() {
|
||||||
auto &discord = Abaddon::Get().GetDiscordClient();
|
auto &discord = Abaddon::Get().GetDiscordClient();
|
||||||
auto msgs = discord.GetMessagesForChannel(m_chat.GetActiveChannel(), 50);
|
auto msgs = discord.GetMessagesForChannel(m_chat.GetActiveChannel(), 50);
|
||||||
|
|||||||
@@ -12,12 +12,6 @@ public:
|
|||||||
void UpdateComponents();
|
void UpdateComponents();
|
||||||
void UpdateMembers();
|
void UpdateMembers();
|
||||||
void UpdateChannelListing();
|
void UpdateChannelListing();
|
||||||
void UpdateChannelsNewGuild(Snowflake id);
|
|
||||||
void UpdateChannelsRemoveGuild(Snowflake id);
|
|
||||||
void UpdateChannelsRemoveChannel(Snowflake id);
|
|
||||||
void UpdateChannelsUpdateChannel(Snowflake id);
|
|
||||||
void UpdateChannelsCreateChannel(Snowflake id);
|
|
||||||
void UpdateChannelsUpdateGuild(Snowflake id);
|
|
||||||
void UpdateChatWindowContents();
|
void UpdateChatWindowContents();
|
||||||
void UpdateChatActiveChannel(Snowflake id);
|
void UpdateChatActiveChannel(Snowflake id);
|
||||||
Snowflake GetChatActiveChannel() const;
|
Snowflake GetChatActiveChannel() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user