fix menu bar updates again (fixes #61)

This commit is contained in:
ouwou 2022-04-15 02:14:25 -04:00
parent 5670dfc1d5
commit 47545d9d32
3 changed files with 13 additions and 6 deletions

View File

@ -154,6 +154,8 @@ int Abaddon::StartGTK() {
m_gtk_app->signal_shutdown().connect(sigc::mem_fun(*this, &Abaddon::OnShutdown), false);
m_main_window->UpdateMenus();
m_main_window->show();
return m_gtk_app->run(*m_main_window);
}
@ -173,11 +175,13 @@ void Abaddon::LoadFromSettings() {
void Abaddon::StartDiscord() {
m_discord.Start();
m_main_window->UpdateMenus();
}
void Abaddon::StopDiscord() {
m_discord.Stop();
SaveState();
m_main_window->UpdateMenus();
}
bool Abaddon::IsDiscordActive() const {
@ -535,6 +539,7 @@ void Abaddon::ActionSetToken() {
m_main_window->UpdateComponents();
GetSettings().DiscordToken = m_discord_token;
}
m_main_window->UpdateMenus();
}
void Abaddon::ActionJoinGuildDialog() {
@ -595,6 +600,8 @@ void Abaddon::ActionChannelOpened(Snowflake id) {
ShowGuildVerificationGateDialog(*channel->GuildID);
}
}
m_main_window->UpdateMenus();
}
void Abaddon::ActionChatLoadHistory(Snowflake id) {

View File

@ -142,6 +142,11 @@ void MainWindow::UpdateChatReactionRemove(Snowflake id, const Glib::ustring &par
m_chat.UpdateReactions(id);
}
void MainWindow::UpdateMenus() {
OnDiscordSubmenuPopup();
OnViewSubmenuPopup();
}
void MainWindow::OnDiscordSubmenuPopup() {
auto &discord = Abaddon::Get().GetDiscordClient();
auto channel_id = GetChatActiveChannel();
@ -237,12 +242,6 @@ void MainWindow::SetupMenu() {
m_menu_bar.append(m_menu_view);
m_menu_bar.show_all();
m_menu_bar.signal_event().connect([this](GdkEvent *ev) -> bool {
OnViewSubmenuPopup();
OnDiscordSubmenuPopup();
return false;
});
m_menu_discord_connect.signal_activate().connect([this] {
m_signal_action_connect.emit();
});

View File

@ -23,6 +23,7 @@ public:
Snowflake GetChatOldestListedMessage();
void UpdateChatReactionAdd(Snowflake id, const Glib::ustring &param);
void UpdateChatReactionRemove(Snowflake id, const Glib::ustring &param);
void UpdateMenus();
ChannelList *GetChannelList();
ChatWindow *GetChatWindow();