diff --git a/src/abaddon.cpp b/src/abaddon.cpp index af28571..a2d65e5 100644 --- a/src/abaddon.cpp +++ b/src/abaddon.cpp @@ -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) { diff --git a/src/windows/mainwindow.cpp b/src/windows/mainwindow.cpp index e12e9bd..4436785 100644 --- a/src/windows/mainwindow.cpp +++ b/src/windows/mainwindow.cpp @@ -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(); }); diff --git a/src/windows/mainwindow.hpp b/src/windows/mainwindow.hpp index 89c6869..0932af5 100644 --- a/src/windows/mainwindow.hpp +++ b/src/windows/mainwindow.hpp @@ -23,6 +23,7 @@ public: Snowflake GetChatOldestListedMessage(); void UpdateChatReactionAdd(Snowflake id, const Glib::ustring ¶m); void UpdateChatReactionRemove(Snowflake id, const Glib::ustring ¶m); + void UpdateMenus(); ChannelList *GetChannelList(); ChatWindow *GetChatWindow();