From a78fdd386f93db366d7327aa736624ad8bc1aa6f Mon Sep 17 00:00:00 2001 From: KnightMurloc <44520059+KnightMurloc@users.noreply.github.com> Date: Fri, 9 Sep 2022 12:03:55 +0700 Subject: add opt-in hide to system tray icon (#99) --- src/windows/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/windows/mainwindow.cpp') diff --git a/src/windows/mainwindow.cpp b/src/windows/mainwindow.cpp index 17edfa3..7f4395c 100644 --- a/src/windows/mainwindow.cpp +++ b/src/windows/mainwindow.cpp @@ -401,4 +401,4 @@ MainWindow::type_signal_action_view_pins MainWindow::signal_action_view_pins() { MainWindow::type_signal_action_view_threads MainWindow::signal_action_view_threads() { return m_signal_action_view_threads; -} +} \ No newline at end of file -- cgit v1.2.3 From 0a34c04b44d3f500317a319d497ce2064fdd852f Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Thu, 6 Oct 2022 03:08:54 -0400 Subject: remove ability to join guilds because 1. joining a guild seems to often require captchas now which are never going to be supported and 2. joining guilds is one of the things that upsets discords spam filter the most, so it kinda makes sense to remove anyways just like open dm --- src/abaddon.cpp | 11 ------ src/dialogs/joinguild.cpp | 97 ---------------------------------------------- src/dialogs/joinguild.hpp | 31 --------------- src/discord/discord.cpp | 4 -- src/discord/discord.hpp | 1 - src/windows/mainwindow.cpp | 12 ------ src/windows/mainwindow.hpp | 4 -- 7 files changed, 160 deletions(-) delete mode 100644 src/dialogs/joinguild.cpp delete mode 100644 src/dialogs/joinguild.hpp (limited to 'src/windows/mainwindow.cpp') diff --git a/src/abaddon.cpp b/src/abaddon.cpp index 02dcd08..ec567e7 100644 --- a/src/abaddon.cpp +++ b/src/abaddon.cpp @@ -6,7 +6,6 @@ #include "discord/discord.hpp" #include "dialogs/token.hpp" #include "dialogs/editmessage.hpp" -#include "dialogs/joinguild.hpp" #include "dialogs/confirm.hpp" #include "dialogs/setstatus.hpp" #include "dialogs/friendpicker.hpp" @@ -229,7 +228,6 @@ int Abaddon::StartGTK() { m_main_window->signal_action_disconnect().connect(sigc::mem_fun(*this, &Abaddon::ActionDisconnect)); m_main_window->signal_action_set_token().connect(sigc::mem_fun(*this, &Abaddon::ActionSetToken)); m_main_window->signal_action_reload_css().connect(sigc::mem_fun(*this, &Abaddon::ActionReloadCSS)); - m_main_window->signal_action_join_guild().connect(sigc::mem_fun(*this, &Abaddon::ActionJoinGuildDialog)); m_main_window->signal_action_set_status().connect(sigc::mem_fun(*this, &Abaddon::ActionSetStatus)); m_main_window->signal_action_add_recipient().connect(sigc::mem_fun(*this, &Abaddon::ActionAddRecipient)); m_main_window->signal_action_view_pins().connect(sigc::mem_fun(*this, &Abaddon::ActionViewPins)); @@ -693,15 +691,6 @@ void Abaddon::ActionSetToken() { m_main_window->UpdateMenus(); } -void Abaddon::ActionJoinGuildDialog() { - JoinGuildDialog dlg(*m_main_window); - auto response = dlg.run(); - if (response == Gtk::RESPONSE_OK) { - auto code = dlg.GetCode(); - m_discord.JoinGuild(code); - } -} - void Abaddon::ActionChannelOpened(Snowflake id, bool expand_to) { if (!id.IsValid()) { m_discord.SetReferringChannel(Snowflake::Invalid); diff --git a/src/dialogs/joinguild.cpp b/src/dialogs/joinguild.cpp deleted file mode 100644 index 14fab53..0000000 --- a/src/dialogs/joinguild.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include "joinguild.hpp" -#include "abaddon.hpp" -#include -#include - -JoinGuildDialog::JoinGuildDialog(Gtk::Window &parent) - : Gtk::Dialog("Join Server", parent, true) - , m_layout(Gtk::ORIENTATION_VERTICAL) - , m_ok("OK") - , m_cancel("Cancel") - , m_info("Enter code") { - set_default_size(300, 50); - get_style_context()->add_class("app-window"); - get_style_context()->add_class("app-popup"); - - Glib::signal_idle().connect(sigc::mem_fun(*this, &JoinGuildDialog::on_idle_slot)); - - m_entry.signal_changed().connect(sigc::mem_fun(*this, &JoinGuildDialog::on_entry_changed)); - - m_ok.set_sensitive(false); - - m_ok.signal_clicked().connect([&]() { - response(Gtk::RESPONSE_OK); - }); - - m_cancel.signal_clicked().connect([&]() { - response(Gtk::RESPONSE_CANCEL); - }); - - m_entry.set_hexpand(true); - m_layout.add(m_entry); - m_lower.set_hexpand(true); - m_lower.pack_start(m_info); - m_info.set_halign(Gtk::ALIGN_START); - m_lower.pack_start(m_ok, Gtk::PACK_SHRINK); - m_lower.pack_start(m_cancel, Gtk::PACK_SHRINK); - m_ok.set_halign(Gtk::ALIGN_END); - m_cancel.set_halign(Gtk::ALIGN_END); - m_layout.add(m_lower); - get_content_area()->add(m_layout); - - show_all_children(); -} - -void JoinGuildDialog::on_entry_changed() { - std::string s = m_entry.get_text(); - std::regex invite_regex(R"((https?:\/\/)?discord\.(gg(\/invite)?\/|com\/invite\/)([A-Za-z0-9\-]+))", std::regex_constants::ECMAScript); - std::smatch match; - bool full_url = std::regex_search(s, match, invite_regex); - if (full_url || IsCode(s)) { - m_code = full_url ? match[4].str() : s; - m_needs_request = true; - m_ok.set_sensitive(false); - } else { - m_ok.set_sensitive(false); - } -} - -void JoinGuildDialog::CheckCode() { - auto cb = [this](const std::optional &invite) { - if (invite.has_value()) { - m_ok.set_sensitive(true); - if (invite->Guild.has_value()) { - if (invite->MemberCount.has_value()) - m_info.set_text(invite->Guild->Name + " (" + std::to_string(*invite->MemberCount) + " members)"); - else - m_info.set_text(invite->Guild->Name); - } else { - m_info.set_text("Group DM (" + std::to_string(*invite->MemberCount) + " members)"); - } - } else { - m_ok.set_sensitive(false); - m_info.set_text("Invalid invite"); - } - }; - Abaddon::Get().GetDiscordClient().FetchInvite(m_code, sigc::track_obj(cb, *this)); -} - -bool JoinGuildDialog::IsCode(std::string str) { - return str.length() >= 2 && std::all_of(str.begin(), str.end(), [](char c) -> bool { return std::isalnum(c) || c == '-'; }); -} - -std::string JoinGuildDialog::GetCode() { - return m_code; -} - -static const constexpr int RateLimitMS = 1500; -bool JoinGuildDialog::on_idle_slot() { - const auto now = std::chrono::steady_clock::now(); - if (m_needs_request && ((now - m_last_req_time) > std::chrono::milliseconds(RateLimitMS))) { - m_needs_request = false; - m_last_req_time = now; - CheckCode(); - } - - return true; -} diff --git a/src/dialogs/joinguild.hpp b/src/dialogs/joinguild.hpp deleted file mode 100644 index ba061f3..0000000 --- a/src/dialogs/joinguild.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once -#include -#include -#include - -class JoinGuildDialog : public Gtk::Dialog { -public: - JoinGuildDialog(Gtk::Window &parent); - std::string GetCode(); - -protected: - void on_entry_changed(); - static bool IsCode(std::string str); - - Gtk::Box m_layout; - Gtk::Button m_ok; - Gtk::Button m_cancel; - Gtk::Box m_lower; - Gtk::Label m_info; - Gtk::Entry m_entry; - - void CheckCode(); - - // needs a rate limit cuz if u hit it u get ip banned from /invites for a long time :( - bool m_needs_request = false; - std::chrono::time_point m_last_req_time; - bool on_idle_slot(); - -private: - std::string m_code; -}; diff --git a/src/discord/discord.cpp b/src/discord/discord.cpp index e1b7a48..2808e17 100644 --- a/src/discord/discord.cpp +++ b/src/discord/discord.cpp @@ -573,10 +573,6 @@ void DiscordClient::SendThreadLazyLoad(Snowflake id) { m_websocket.Send(msg); } -void DiscordClient::JoinGuild(const std::string &code) { - m_http.MakePOST("/invites/" + code, "{}", [](auto) {}); -} - void DiscordClient::LeaveGuild(Snowflake id) { m_http.MakeDELETE("/users/@me/guilds/" + std::to_string(id), [](auto) {}); } diff --git a/src/discord/discord.hpp b/src/discord/discord.hpp index 70c2d82..c2bea7d 100644 --- a/src/discord/discord.hpp +++ b/src/discord/discord.hpp @@ -113,7 +113,6 @@ public: void EditMessage(Snowflake channel_id, Snowflake id, std::string content); void SendLazyLoad(Snowflake id); void SendThreadLazyLoad(Snowflake id); - void JoinGuild(const std::string &code); void LeaveGuild(Snowflake id); void KickUser(Snowflake user_id, Snowflake guild_id); void BanUser(Snowflake user_id, Snowflake guild_id); // todo: reason, delete messages diff --git a/src/windows/mainwindow.cpp b/src/windows/mainwindow.cpp index 7f4395c..07a7f17 100644 --- a/src/windows/mainwindow.cpp +++ b/src/windows/mainwindow.cpp @@ -195,7 +195,6 @@ void MainWindow::OnDiscordSubmenuPopup() { std::string token = Abaddon::Get().GetDiscordToken(); m_menu_discord_connect.set_sensitive(!token.empty() && !discord_active); m_menu_discord_disconnect.set_sensitive(discord_active); - m_menu_discord_join_guild.set_sensitive(discord_active); m_menu_discord_set_token.set_sensitive(!discord_active); m_menu_discord_set_status.set_sensitive(discord_active); } @@ -238,15 +237,12 @@ void MainWindow::SetupMenu() { m_menu_discord_disconnect.set_label("Disconnect"); m_menu_discord_disconnect.set_sensitive(false); m_menu_discord_set_token.set_label("Set Token"); - m_menu_discord_join_guild.set_label("Accept Invite"); - m_menu_discord_join_guild.set_sensitive(false); m_menu_discord_set_status.set_label("Set Status"); m_menu_discord_set_status.set_sensitive(false); m_menu_discord_add_recipient.set_label("Add user to DM"); m_menu_discord_sub.append(m_menu_discord_connect); m_menu_discord_sub.append(m_menu_discord_disconnect); m_menu_discord_sub.append(m_menu_discord_set_token); - m_menu_discord_sub.append(m_menu_discord_join_guild); m_menu_discord_sub.append(m_menu_discord_set_status); m_menu_discord_sub.append(m_menu_discord_add_recipient); m_menu_discord.set_submenu(m_menu_discord_sub); @@ -297,10 +293,6 @@ void MainWindow::SetupMenu() { m_signal_action_set_token.emit(); }); - m_menu_discord_join_guild.signal_activate().connect([this] { - m_signal_action_join_guild.emit(); - }); - m_menu_file_reload_css.signal_activate().connect([this] { m_signal_action_reload_css.emit(); }); @@ -383,10 +375,6 @@ MainWindow::type_signal_action_reload_css MainWindow::signal_action_reload_css() return m_signal_action_reload_css; } -MainWindow::type_signal_action_join_guild MainWindow::signal_action_join_guild() { - return m_signal_action_join_guild; -} - MainWindow::type_signal_action_set_status MainWindow::signal_action_set_status() { return m_signal_action_set_status; } diff --git a/src/windows/mainwindow.hpp b/src/windows/mainwindow.hpp index 534df1b..b013e32 100644 --- a/src/windows/mainwindow.hpp +++ b/src/windows/mainwindow.hpp @@ -63,7 +63,6 @@ private: Gtk::MenuItem m_menu_discord_connect; Gtk::MenuItem m_menu_discord_disconnect; Gtk::MenuItem m_menu_discord_set_token; - Gtk::MenuItem m_menu_discord_join_guild; Gtk::MenuItem m_menu_discord_set_status; Gtk::MenuItem m_menu_discord_add_recipient; // move me somewhere else some day void OnDiscordSubmenuPopup(); @@ -91,7 +90,6 @@ public: typedef sigc::signal type_signal_action_disconnect; typedef sigc::signal type_signal_action_set_token; typedef sigc::signal type_signal_action_reload_css; - typedef sigc::signal type_signal_action_join_guild; typedef sigc::signal type_signal_action_set_status; // this should probably be removed typedef sigc::signal type_signal_action_add_recipient; // channel id @@ -102,7 +100,6 @@ public: type_signal_action_disconnect signal_action_disconnect(); type_signal_action_set_token signal_action_set_token(); type_signal_action_reload_css signal_action_reload_css(); - type_signal_action_join_guild signal_action_join_guild(); type_signal_action_set_status signal_action_set_status(); type_signal_action_add_recipient signal_action_add_recipient(); type_signal_action_view_pins signal_action_view_pins(); @@ -113,7 +110,6 @@ private: type_signal_action_disconnect m_signal_action_disconnect; type_signal_action_set_token m_signal_action_set_token; type_signal_action_reload_css m_signal_action_reload_css; - type_signal_action_join_guild m_signal_action_join_guild; type_signal_action_set_status m_signal_action_set_status; type_signal_action_add_recipient m_signal_action_add_recipient; type_signal_action_view_pins m_signal_action_view_pins; -- cgit v1.2.3 From 772598996c24d570cb74686c4d888d6f1aa070ad Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Sun, 23 Oct 2022 02:56:07 +0000 Subject: Add option to hide the menu bar behind alt key (#115) --- README.md | 16 +++++++++++++--- src/abaddon.cpp | 20 +++++++++++++++----- src/settings.cpp | 2 ++ src/settings.hpp | 2 +- src/windows/mainwindow.cpp | 24 +++++++++++++++++++++++- src/windows/mainwindow.hpp | 1 + 6 files changed, 55 insertions(+), 10 deletions(-) (limited to 'src/windows/mainwindow.cpp') diff --git a/README.md b/README.md index a059990..555b129 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,15 @@ Current features: * Thread support3 * Animated avatars, server icons, emojis (can be turned off) -1 - Abaddon tries its best (though is not perfect) to make Discord think it's a legitimate web client. Some of the things done to do this +1 - Abaddon tries its best (though is not perfect) to make Discord think it's a legitimate web client. Some of the +things done to do this include: using a browser user agent, sending the same IDENTIFY message that the official web client does, using API v9 endpoints in all cases, and not using endpoints the web client does not normally use. There are still a few smaller inconsistencies, however. For example the web client sends lots of telemetry via the `/science` endpoint (uBlock origin stops this) as well as in the headers of all requests.
-**See [here](#the-spam-filter)** for things you might want to avoid if you are worried about being caught in the spam filter. +**See [here](#the-spam-filter)** for things you might want to avoid if you are worried about being caught in the spam +filter. 2 - Unicode emojis are substituted manually as opposed to rendered by GTK on non-Windows platforms. This can be changed with the `stock_emojis` setting as shown at the bottom of this README. A CBDT-based font using Twemoji is provided to @@ -99,7 +101,12 @@ no `abaddon.ini` in the working directory #### The Spam Filter -Discord likes disabling accounts/forcing them to reset their passwords if they think the user is a spam bot or potentially had their account compromised. While the official client still often gets users caught in the spam filter, third party clients tend to upset the spam filter more often. If you get caught by it, you can usually [appeal](https://support.discord.com/hc/en-us/requests/new?ticket_form_id=360000029731) it and get it restored. Here are some things you might want to do with the official client instead if you are particularly afraid of evoking the spam filter's wrath: +Discord likes disabling accounts/forcing them to reset their passwords if they think the user is a spam bot or +potentially had their account compromised. While the official client still often gets users caught in the spam filter, +third party clients tend to upset the spam filter more often. If you get caught by it, you can +usually [appeal](https://support.discord.com/hc/en-us/requests/new?ticket_form_id=360000029731) it and get it restored. +Here are some things you might want to do with the official client instead if you are particularly afraid of evoking the +spam filter's wrath: * Joining or leaving servers (usually main cause of getting caught) * Frequently disconnecting and reconnecting @@ -252,6 +259,9 @@ For example, memory_db would be set by adding `memory_db = true` under the line over * owner_crown (true or false, default true) - show a crown next to the owner * unreads (true or false, default true) - show unread indicators and mention badges +* save_state (true or false, default true) - save the state of the gui (active channels, tabs, expanded channels) +* alt_menu (true or false, default false) - keep the menu hidden unless revealed with alt key +* hide_to_tray (true or false, default false) - hide abaddon to the system tray on window close #### style diff --git a/src/abaddon.cpp b/src/abaddon.cpp index ec567e7..630e584 100644 --- a/src/abaddon.cpp +++ b/src/abaddon.cpp @@ -68,14 +68,13 @@ Abaddon &Abaddon::Get() { return instance; } -#ifdef WITH_LIBHANDY - #ifdef _WIN32 +#ifdef _WIN32 constexpr static guint BUTTON_BACK = 4; constexpr static guint BUTTON_FORWARD = 5; - #else +#else constexpr static guint BUTTON_BACK = 8; constexpr static guint BUTTON_FORWARD = 9; - #endif +#endif static bool HandleButtonEvents(GdkEvent *event, MainWindow *main_window) { if (event->type != GDK_BUTTON_PRESS) return false; @@ -85,6 +84,7 @@ static bool HandleButtonEvents(GdkEvent *event, MainWindow *main_window) { auto *window = gtk_widget_get_toplevel(widget); if (static_cast(window) != static_cast(main_window->gobj())) return false; // is this the right way??? +#ifdef WITH_LIBHANDY switch (event->button.button) { case BUTTON_BACK: main_window->GoBack(); @@ -93,6 +93,7 @@ static bool HandleButtonEvents(GdkEvent *event, MainWindow *main_window) { main_window->GoForward(); break; } +#endif return false; } @@ -108,6 +109,15 @@ static bool HandleKeyEvents(GdkEvent *event, MainWindow *main_window) { const bool ctrl = (event->key.state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK; const bool shft = (event->key.state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK; + constexpr static guint EXCLUDE_STATES = GDK_CONTROL_MASK | GDK_SHIFT_MASK; + + if (!(event->key.state & EXCLUDE_STATES) && event->key.keyval == GDK_KEY_Alt_L) { + if (Abaddon::Get().GetSettings().AltMenu) { + main_window->ToggleMenuVisibility(); + } + } + +#ifdef WITH_LIBHANDY if (ctrl) { switch (event->key.keyval) { case GDK_KEY_Tab: @@ -134,6 +144,7 @@ static bool HandleKeyEvents(GdkEvent *event, MainWindow *main_window) { return true; } } +#endif return false; } @@ -143,7 +154,6 @@ static void MainEventHandler(GdkEvent *event, void *main_window) { if (HandleKeyEvents(event, static_cast(main_window))) return; gtk_main_do_event(event); } -#endif int Abaddon::StartGTK() { m_gtk_app = Gtk::Application::create("com.github.uowuo.abaddon"); diff --git a/src/settings.cpp b/src/settings.cpp index dd1fe83..34b3dc0 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -48,6 +48,7 @@ void SettingsManager::ReadSettings() { SMBOOL("gui", "save_state", SaveState); SMBOOL("gui", "stock_emojis", ShowStockEmojis); SMBOOL("gui", "unreads", Unreads); + SMBOOL("gui", "alt_menu", AltMenu); SMBOOL("gui", "hide_to_tray", HideToTray); SMINT("http", "concurrent", CacheHTTPConcurrency); SMSTR("http", "user_agent", UserAgent); @@ -102,6 +103,7 @@ void SettingsManager::Close() { SMBOOL("gui", "save_state", SaveState); SMBOOL("gui", "stock_emojis", ShowStockEmojis); SMBOOL("gui", "unreads", Unreads); + SMBOOL("gui", "alt_menu", AltMenu); SMBOOL("gui", "hide_to_tray", HideToTray); SMINT("http", "concurrent", CacheHTTPConcurrency); SMSTR("http", "user_agent", UserAgent); diff --git a/src/settings.hpp b/src/settings.hpp index 7f5e015..4ab512e 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -27,7 +27,7 @@ public: bool ShowStockEmojis { true }; #endif bool Unreads { true }; - + bool AltMenu { false }; bool HideToTray { false }; // [http] diff --git a/src/windows/mainwindow.cpp b/src/windows/mainwindow.cpp index 07a7f17..20da46b 100644 --- a/src/windows/mainwindow.cpp +++ b/src/windows/mainwindow.cpp @@ -158,6 +158,10 @@ void MainWindow::UpdateMenus() { OnViewSubmenuPopup(); } +void MainWindow::ToggleMenuVisibility() { + m_menu_bar.set_visible(!m_menu_bar.get_visible()); +} + #ifdef WITH_LIBHANDY void MainWindow::GoBack() { m_chat.GoBack(); @@ -279,7 +283,25 @@ void MainWindow::SetupMenu() { m_menu_bar.append(m_menu_file); m_menu_bar.append(m_menu_discord); m_menu_bar.append(m_menu_view); - m_menu_bar.show_all(); + + if (Abaddon::Get().GetSettings().AltMenu) { + auto set_hide_cb = [this](Gtk::Menu &menu) { + for (auto *child : menu.get_children()) { + auto *item = dynamic_cast(child); + if (item != nullptr) { + item->signal_activate().connect([this]() { + m_menu_bar.hide(); + }); + } + } + }; + set_hide_cb(m_menu_discord_sub); + set_hide_cb(m_menu_file_sub); + set_hide_cb(m_menu_view_sub); + m_menu_bar.show_all_children(); + } else { + m_menu_bar.show_all(); + } 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 b013e32..6e95b72 100644 --- a/src/windows/mainwindow.hpp +++ b/src/windows/mainwindow.hpp @@ -24,6 +24,7 @@ public: void UpdateChatReactionAdd(Snowflake id, const Glib::ustring ¶m); void UpdateChatReactionRemove(Snowflake id, const Glib::ustring ¶m); void UpdateMenus(); + void ToggleMenuVisibility(); #ifdef WITH_LIBHANDY void GoBack(); -- cgit v1.2.3 From 2a9f49a1485a145668923a550347af8890e88bf0 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Thu, 3 Nov 2022 00:45:31 -0400 Subject: add menu item + shortcuts to hide channel and member lists (closes #118) --- src/windows/mainwindow.cpp | 16 ++++++++++++++++ src/windows/mainwindow.hpp | 2 ++ 2 files changed, 18 insertions(+) (limited to 'src/windows/mainwindow.cpp') diff --git a/src/windows/mainwindow.cpp b/src/windows/mainwindow.cpp index 20da46b..8a85d49 100644 --- a/src/windows/mainwindow.cpp +++ b/src/windows/mainwindow.cpp @@ -265,6 +265,12 @@ void MainWindow::SetupMenu() { m_menu_view_threads.set_label("Threads"); m_menu_view_mark_guild_as_read.set_label("Mark Server as Read"); m_menu_view_mark_guild_as_read.add_accelerator("activate", m_accels, GDK_KEY_Escape, Gdk::SHIFT_MASK, Gtk::ACCEL_VISIBLE); + m_menu_view_channels.set_label("Channels"); + m_menu_view_channels.add_accelerator("activate", m_accels, GDK_KEY_L, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); + m_menu_view_channels.set_active(true); + m_menu_view_members.set_label("Members"); + m_menu_view_members.add_accelerator("activate", m_accels, GDK_KEY_M, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); + m_menu_view_members.set_active(true); #ifdef WITH_LIBHANDY m_menu_view_go_back.set_label("Go Back"); m_menu_view_go_forward.set_label("Go Forward"); @@ -275,6 +281,8 @@ void MainWindow::SetupMenu() { m_menu_view_sub.append(m_menu_view_pins); m_menu_view_sub.append(m_menu_view_threads); m_menu_view_sub.append(m_menu_view_mark_guild_as_read); + m_menu_view_sub.append(m_menu_view_channels); + m_menu_view_sub.append(m_menu_view_members); #ifdef WITH_LIBHANDY m_menu_view_sub.append(m_menu_view_go_back); m_menu_view_sub.append(m_menu_view_go_forward); @@ -354,6 +362,14 @@ void MainWindow::SetupMenu() { } }); + m_menu_view_channels.signal_activate().connect([this]() { + m_channel_list.set_visible(m_menu_view_channels.get_active()); + }); + + m_menu_view_members.signal_activate().connect([this]() { + m_members.GetRoot()->set_visible(m_menu_view_members.get_active()); + }); + #ifdef WITH_LIBHANDY m_menu_view_go_back.signal_activate().connect([this] { GoBack(); diff --git a/src/windows/mainwindow.hpp b/src/windows/mainwindow.hpp index 6e95b72..78e0115 100644 --- a/src/windows/mainwindow.hpp +++ b/src/windows/mainwindow.hpp @@ -79,6 +79,8 @@ private: Gtk::MenuItem m_menu_view_pins; Gtk::MenuItem m_menu_view_threads; Gtk::MenuItem m_menu_view_mark_guild_as_read; + Gtk::CheckMenuItem m_menu_view_channels; + Gtk::CheckMenuItem m_menu_view_members; #ifdef WITH_LIBHANDY Gtk::MenuItem m_menu_view_go_back; Gtk::MenuItem m_menu_view_go_forward; -- cgit v1.2.3