summaryrefslogtreecommitdiff
path: root/windows
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2021-05-14 03:18:05 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2021-05-14 03:18:05 -0400
commit1c5f91201979d63ca4f96825f52ba1d5bcae06ef (patch)
tree8e78c141074210b0ed274372b12f63a1ac701bc2 /windows
parent95eb6646415d859931532e7b22967b7c68ddb02b (diff)
parent223a18512473fc790f6ad72a8344061de92812c8 (diff)
downloadabaddon-portaudio-1c5f91201979d63ca4f96825f52ba1d5bcae06ef.tar.gz
abaddon-portaudio-1c5f91201979d63ca4f96825f52ba1d5bcae06ef.zip
Merge branch 'master' into friends
Diffstat (limited to 'windows')
-rw-r--r--windows/guildsettings/auditlogpane.cpp161
-rw-r--r--windows/guildsettings/auditlogpane.hpp5
-rw-r--r--windows/guildsettings/banspane.cpp3
-rw-r--r--windows/guildsettings/banspane.hpp5
-rw-r--r--windows/guildsettings/emojispane.cpp3
-rw-r--r--windows/guildsettings/emojispane.hpp6
-rw-r--r--windows/guildsettings/invitespane.cpp3
-rw-r--r--windows/guildsettings/invitespane.hpp5
-rw-r--r--windows/guildsettingswindow.cpp6
-rw-r--r--windows/profile/mutualfriendspane.cpp3
-rw-r--r--windows/profile/mutualfriendspane.hpp5
-rw-r--r--windows/profilewindow.cpp6
12 files changed, 139 insertions, 72 deletions
diff --git a/windows/guildsettings/auditlogpane.cpp b/windows/guildsettings/auditlogpane.cpp
index d2cbc94..5745d17 100644
--- a/windows/guildsettings/auditlogpane.cpp
+++ b/windows/guildsettings/auditlogpane.cpp
@@ -5,6 +5,7 @@ using namespace std::string_literals;
GuildSettingsAuditLogPane::GuildSettingsAuditLogPane(Snowflake id)
: GuildID(id) {
+ signal_map().connect(sigc::mem_fun(*this, &GuildSettingsAuditLogPane::OnMap));
set_name("guild-audit-log-pane");
set_hexpand(true);
set_vexpand(true);
@@ -14,7 +15,7 @@ GuildSettingsAuditLogPane::GuildSettingsAuditLogPane(Snowflake id)
add(m_list);
}
-void GuildSettingsAuditLogPane::on_switched_to() {
+void GuildSettingsAuditLogPane::OnMap() {
if (m_requested) return;
m_requested = true;
@@ -33,7 +34,11 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
auto label = Gtk::manage(new Gtk::Label);
label->set_ellipsize(Pango::ELLIPSIZE_END);
- auto user = *discord.GetUser(entry.UserID);
+ Glib::ustring user_markup = "<b>Unknown User</b>";
+ if (entry.UserID.has_value()) {
+ if (auto user = discord.GetUser(*entry.UserID); user.has_value())
+ user_markup = discord.GetUser(*entry.UserID)->GetEscapedBoldString<false>();
+ }
// spaghetti moment
Glib::ustring markup;
@@ -41,7 +46,7 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
switch (entry.Type) {
case AuditLogActionType::GUILD_UPDATE: {
markup =
- user.GetEscapedBoldString<false>() +
+ user_markup +
" made changes to <b>" +
Glib::Markup::escape_text(guild.Name) +
"</b>";
@@ -63,7 +68,7 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
} break;
case AuditLogActionType::CHANNEL_CREATE: {
const auto type = *entry.GetNewFromKey<ChannelType>("type");
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" created a " + (type == ChannelType::GUILD_VOICE ? "voice" : "text") +
" channel <b>#" +
Glib::Markup::escape_text(*entry.GetNewFromKey<std::string>("name")) +
@@ -83,12 +88,12 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
case AuditLogActionType::CHANNEL_UPDATE: {
const auto target_channel = discord.GetChannel(entry.TargetID);
if (target_channel.has_value()) {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" made changes to <b>#" +
Glib::Markup::escape_text(*target_channel->Name) +
"</b>";
} else {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" made changes to <b>&lt;#" +
entry.TargetID +
"&gt;</b>";
@@ -126,7 +131,7 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
}
} break;
case AuditLogActionType::CHANNEL_DELETE: {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" removed <b>#" +
Glib::Markup::escape_text(*entry.GetOldFromKey<std::string>("name")) +
"</b>";
@@ -134,11 +139,11 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
case AuditLogActionType::CHANNEL_OVERWRITE_CREATE: {
const auto channel = discord.GetChannel(entry.TargetID);
if (channel.has_value()) {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" created channel overrides for <b>#" +
Glib::Markup::escape_text(*channel->Name) + "</b>";
} else {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" created channel overrides for <b>&lt;#" +
entry.TargetID + "&gt;</b>";
}
@@ -146,11 +151,11 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
case AuditLogActionType::CHANNEL_OVERWRITE_UPDATE: {
const auto channel = discord.GetChannel(entry.TargetID);
if (channel.has_value()) {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" updated channel overrides for <b>#" +
Glib::Markup::escape_text(*channel->Name) + "</b>";
} else {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" updated channel overrides for <b>&lt;#" +
entry.TargetID + "&gt;</b>";
}
@@ -158,24 +163,24 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
case AuditLogActionType::CHANNEL_OVERWRITE_DELETE: {
const auto channel = discord.GetChannel(entry.TargetID);
if (channel.has_value()) {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" removed channel overrides for <b>#" +
Glib::Markup::escape_text(*channel->Name) + "</b>";
} else {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" removed channel overrides for <b>&lt;#" +
entry.TargetID + "&gt;</b>";
}
} break;
case AuditLogActionType::MEMBER_KICK: {
const auto target_user = discord.GetUser(entry.TargetID);
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" kicked <b>" +
target_user->GetEscapedString() +
"</b>";
} break;
case AuditLogActionType::MEMBER_PRUNE: {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" pruned <b>" +
*entry.Options->MembersRemoved +
"</b> members";
@@ -185,21 +190,21 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
} break;
case AuditLogActionType::MEMBER_BAN_ADD: {
const auto target_user = discord.GetUser(entry.TargetID);
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" banned <b>" +
target_user->GetEscapedString() +
"</b>";
} break;
case AuditLogActionType::MEMBER_BAN_REMOVE: {
const auto target_user = discord.GetUser(entry.TargetID);
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" removed the ban for <b>" +
target_user->GetEscapedString() +
"</b>";
} break;
case AuditLogActionType::MEMBER_UPDATE: {
const auto target_user = discord.GetUser(entry.TargetID);
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" updated <b>" +
target_user->GetEscapedString() +
"</b>";
@@ -221,7 +226,7 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
} break;
case AuditLogActionType::MEMBER_ROLE_UPDATE: {
const auto target_user = discord.GetUser(entry.TargetID);
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" updated roles for <b>" +
target_user->GetEscapedString() + "</b>";
if (entry.Changes.has_value())
@@ -239,7 +244,7 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
} break;
case AuditLogActionType::MEMBER_MOVE: {
const auto channel = discord.GetChannel(*entry.Options->ChannelID);
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" moved <b>" +
*entry.Options->Count +
" user" +
@@ -249,27 +254,27 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
"</b>";
} break;
case AuditLogActionType::MEMBER_DISCONNECT: {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" disconnected <b>" +
*entry.Options->Count +
"</b> users from voice";
} break;
case AuditLogActionType::BOT_ADD: {
const auto target_user = discord.GetUser(entry.TargetID);
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" added <b>" +
target_user->GetEscapedString() +
"</b> to the server";
} break;
case AuditLogActionType::ROLE_CREATE: {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" created the role <b>" +
*entry.GetNewFromKey<std::string>("name") +
"</b>";
} break;
case AuditLogActionType::ROLE_UPDATE: {
const auto role = discord.GetRole(entry.TargetID);
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" updated the role <b>" +
(role.has_value() ? Glib::Markup::escape_text(role->Name) : Glib::ustring(entry.TargetID)) +
"</b>";
@@ -297,14 +302,14 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
}
} break;
case AuditLogActionType::ROLE_DELETE: {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" deleted the role <b>" +
*entry.GetOldFromKey<std::string>("name") +
"</b>";
} break;
case AuditLogActionType::INVITE_CREATE: {
const auto code = *entry.GetNewFromKey<std::string>("code");
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" created an invite <b>" + code + "</b>";
if (entry.Changes.has_value())
for (const auto &change : *entry.Changes) {
@@ -328,13 +333,13 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
}
} break;
case AuditLogActionType::INVITE_DELETE: {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" deleted an invite <b>" +
*entry.GetOldFromKey<std::string>("code") +
"</b>";
} break;
case AuditLogActionType::WEBHOOK_CREATE: {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" created the webhook <b>" +
Glib::Markup::escape_text(*entry.GetNewFromKey<std::string>("name")) +
"</b>";
@@ -356,12 +361,12 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
webhookptr = &webhook;
}
if (webhookptr != nullptr) {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" updated the webhook <b>" +
Glib::Markup::escape_text(webhookptr->Name) +
"</b>";
} else {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" updated a webhook";
}
if (entry.Changes.has_value())
@@ -385,19 +390,19 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
}
} break;
case AuditLogActionType::WEBHOOK_DELETE: {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" deleted the webhook <b>" +
Glib::Markup::escape_text(*entry.GetOldFromKey<std::string>("name")) +
"</b>";
} break;
case AuditLogActionType::EMOJI_CREATE: {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" created the emoji <b>" +
Glib::Markup::escape_text(*entry.GetNewFromKey<std::string>("name")) +
"</b>";
} break;
case AuditLogActionType::EMOJI_UPDATE: {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" updated the emoji <b>" +
Glib::Markup::escape_text(*entry.GetOldFromKey<std::string>("name")) +
"</b>";
@@ -408,7 +413,7 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
"</b>");
} break;
case AuditLogActionType::EMOJI_DELETE: {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" deleted the emoji <b>" +
Glib::Markup::escape_text(*entry.GetOldFromKey<std::string>("name")) +
"</b>";
@@ -417,26 +422,26 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
const auto channel = discord.GetChannel(*entry.Options->ChannelID);
const auto count = *entry.Options->Count;
if (channel.has_value()) {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" deleted <b>" + count + "</b> messages in <b>#" +
Glib::Markup::escape_text(*channel->Name) +
"</b>";
} else {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" deleted <b>" + count + "</b> messages";
}
} break;
case AuditLogActionType::MESSAGE_BULK_DELETE: {
const auto channel = discord.GetChannel(entry.TargetID);
if (channel.has_value()) {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" deleted <b>" +
*entry.Options->Count +
"</b> messages in <b>#" +
Glib::Markup::escape_text(*channel->Name) +
"</b>";
} else {
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" deleted <b>" +
*entry.Options->Count +
"</b> messages";
@@ -444,18 +449,94 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
} break;
case AuditLogActionType::MESSAGE_PIN: {
const auto target_user = discord.GetUser(entry.TargetID);
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" pinned a message by <b>" +
target_user->GetEscapedString() +
"</b>";
} break;
case AuditLogActionType::MESSAGE_UNPIN: {
const auto target_user = discord.GetUser(entry.TargetID);
- markup = user.GetEscapedBoldString<false>() +
+ markup = user_markup +
" unpinned a message by <b>" +
target_user->GetEscapedString() +
"</b>";
} break;
+ case AuditLogActionType::STAGE_INSTANCE_CREATE: {
+ const auto channel = discord.GetChannel(*entry.Options->ChannelID);
+ if (channel.has_value()) {
+ markup = user_markup +
+ " started the stage for <b>" +
+ Glib::Markup::escape_text(*channel->Name) +
+ "</b>";
+ } else {
+ markup = user_markup +
+ " started the stage for <b>" +
+ std::to_string(*entry.Options->ChannelID) +
+ "</b>";
+ }
+
+ if (entry.Changes.has_value()) {
+ for (const auto &change : *entry.Changes) {
+ if (change.Key == "topic" && change.NewValue.has_value()) {
+ extra_markup.push_back(
+ "Set the topic to <b>" +
+ Glib::Markup::escape_text(change.NewValue->get<std::string>()) +
+ "</b>");
+ } else if (change.Key == "privacy_level" && change.NewValue.has_value()) {
+ Glib::ustring str = Glib::Markup::escape_text(GetStagePrivacyDisplayString(change.NewValue->get<StagePrivacy>()));
+ extra_markup.push_back(
+ "Set the privacy level to <b>" +
+ str +
+ "</b>");
+ }
+ }
+ }
+ } break;
+ case AuditLogActionType::STAGE_INSTANCE_UPDATE: {
+ const auto channel = discord.GetChannel(*entry.Options->ChannelID);
+ if (channel.has_value()) {
+ markup = user_markup +
+ " updated the stage for <b>" +
+ Glib::Markup::escape_text(*channel->Name) +
+ "</b>";
+ } else {
+ markup = user_markup +
+ " updated the stage for <b>" +
+ std::to_string(*entry.Options->ChannelID) +
+ "</b>";
+ }
+
+ if (entry.Changes.has_value()) {
+ for (const auto &change : *entry.Changes) {
+ if (change.Key == "topic" && change.NewValue.has_value()) {
+ extra_markup.push_back(
+ "Set the topic to <b>" +
+ Glib::Markup::escape_text(change.NewValue->get<std::string>()) +
+ "</b>");
+ } else if (change.Key == "privacy_level" && change.NewValue.has_value()) {
+ Glib::ustring str = Glib::Markup::escape_text(GetStagePrivacyDisplayString(change.NewValue->get<StagePrivacy>()));
+ extra_markup.push_back(
+ "Set the privacy level to <b>" +
+ str +
+ "</b>");
+ }
+ }
+ }
+ } break;
+ case AuditLogActionType::STAGE_INSTANCE_DELETE: {
+ const auto channel = discord.GetChannel(*entry.Options->ChannelID);
+ if (channel.has_value()) {
+ markup = user_markup +
+ " ended the stage for <b>" +
+ Glib::Markup::escape_text(*channel->Name) +
+ "</b>";
+ } else {
+ markup = user_markup +
+ " ended the stage for <b>" +
+ std::to_string(*entry.Options->ChannelID) +
+ "</b>";
+ }
+ } break;
default:
markup = "<i>Unknown action</i>";
break;
diff --git a/windows/guildsettings/auditlogpane.hpp b/windows/guildsettings/auditlogpane.hpp
index 9421e22..89749aa 100644
--- a/windows/guildsettings/auditlogpane.hpp
+++ b/windows/guildsettings/auditlogpane.hpp
@@ -1,14 +1,13 @@
#pragma once
#include <gtkmm.h>
-#include "../../components//inotifyswitched.hpp"
#include "../../discord/objects.hpp"
-class GuildSettingsAuditLogPane : public Gtk::ScrolledWindow, public INotifySwitched {
+class GuildSettingsAuditLogPane : public Gtk::ScrolledWindow {
public:
GuildSettingsAuditLogPane(Snowflake id);
private:
- void on_switched_to() override;
+ void OnMap();
bool m_requested = false;
diff --git a/windows/guildsettings/banspane.cpp b/windows/guildsettings/banspane.cpp
index f75e8d6..65366b4 100644
--- a/windows/guildsettings/banspane.cpp
+++ b/windows/guildsettings/banspane.cpp
@@ -10,6 +10,7 @@ GuildSettingsBansPane::GuildSettingsBansPane(Snowflake id)
, m_menu_unban("Unban")
, m_menu_copy_id("Copy ID")
, m_model(Gtk::ListStore::create(m_columns)) {
+ signal_map().connect(sigc::mem_fun(*this, &GuildSettingsBansPane::OnMap));
set_name("guild-bans-pane");
set_hexpand(true);
set_vexpand(true);
@@ -54,7 +55,7 @@ GuildSettingsBansPane::GuildSettingsBansPane(Snowflake id)
m_view.append_column("Reason", m_columns.m_col_reason);
}
-void GuildSettingsBansPane::on_switched_to() {
+void GuildSettingsBansPane::OnMap() {
if (m_requested) return;
m_requested = true;
diff --git a/windows/guildsettings/banspane.hpp b/windows/guildsettings/banspane.hpp
index 39fef78..ead118e 100644
--- a/windows/guildsettings/banspane.hpp
+++ b/windows/guildsettings/banspane.hpp
@@ -1,15 +1,14 @@
#pragma once
#include <gtkmm.h>
-#include "../../components/inotifyswitched.hpp"
#include "../../discord/snowflake.hpp"
#include "../../discord/ban.hpp"
-class GuildSettingsBansPane : public Gtk::Box, public INotifySwitched {
+class GuildSettingsBansPane : public Gtk::Box {
public:
GuildSettingsBansPane(Snowflake id);
private:
- void on_switched_to() override;
+ void OnMap();
bool m_requested = false;
diff --git a/windows/guildsettings/emojispane.cpp b/windows/guildsettings/emojispane.cpp
index ecee64e..7a88938 100644
--- a/windows/guildsettings/emojispane.cpp
+++ b/windows/guildsettings/emojispane.cpp
@@ -11,6 +11,7 @@ GuildSettingsEmojisPane::GuildSettingsEmojisPane(Snowflake guild_id)
, m_menu_delete("Delete")
, m_menu_copy_emoji_url("Copy Emoji URL")
, m_menu_show_emoji("Open in Browser") {
+ signal_map().connect(sigc::mem_fun(*this, &GuildSettingsEmojisPane::OnMap));
set_name("guild-emojis-pane");
m_view_scroll.set_hexpand(true);
@@ -97,7 +98,7 @@ GuildSettingsEmojisPane::GuildSettingsEmojisPane(Snowflake guild_id)
column->set_resizable(true);
}
-void GuildSettingsEmojisPane::on_switched_to() {
+void GuildSettingsEmojisPane::OnMap() {
m_view.grab_focus();
if (m_requested) return;
diff --git a/windows/guildsettings/emojispane.hpp b/windows/guildsettings/emojispane.hpp
index 806babb..19203c7 100644
--- a/windows/guildsettings/emojispane.hpp
+++ b/windows/guildsettings/emojispane.hpp
@@ -1,15 +1,13 @@
#pragma once
#include <gtkmm.h>
-#include "../../components/inotifyswitched.hpp"
#include "../../discord/emoji.hpp"
-class GuildSettingsEmojisPane : public Gtk::Box
- , public INotifySwitched {
+class GuildSettingsEmojisPane : public Gtk::Box {
public:
GuildSettingsEmojisPane(Snowflake guild_id);
private:
- void on_switched_to() override;
+ void OnMap();
bool m_requested = false;
diff --git a/windows/guildsettings/invitespane.cpp b/windows/guildsettings/invitespane.cpp
index 70e193f..9b23377 100644
--- a/windows/guildsettings/invitespane.cpp
+++ b/windows/guildsettings/invitespane.cpp
@@ -5,6 +5,7 @@ GuildSettingsInvitesPane::GuildSettingsInvitesPane(Snowflake id)
: GuildID(id)
, m_model(Gtk::ListStore::create(m_columns))
, m_menu_delete("Delete") {
+ signal_map().connect(sigc::mem_fun(*this, &GuildSettingsInvitesPane::OnMap));
set_name("guild-invites-pane");
set_hexpand(true);
set_vexpand(true);
@@ -36,7 +37,7 @@ GuildSettingsInvitesPane::GuildSettingsInvitesPane(Snowflake id)
column->set_resizable(true);
}
-void GuildSettingsInvitesPane::on_switched_to() {
+void GuildSettingsInvitesPane::OnMap() {
if (m_requested) return;
m_requested = true;
diff --git a/windows/guildsettings/invitespane.hpp b/windows/guildsettings/invitespane.hpp
index b9d1255..577e195 100644
--- a/windows/guildsettings/invitespane.hpp
+++ b/windows/guildsettings/invitespane.hpp
@@ -1,14 +1,13 @@
#pragma once
#include <gtkmm.h>
-#include "../../components/inotifyswitched.hpp"
#include "../../discord/objects.hpp"
-class GuildSettingsInvitesPane : public Gtk::ScrolledWindow, public INotifySwitched {
+class GuildSettingsInvitesPane : public Gtk::ScrolledWindow {
public:
GuildSettingsInvitesPane(Snowflake id);
private:
- void on_switched_to() override;
+ void OnMap();
bool m_requested = false;
diff --git a/windows/guildsettingswindow.cpp b/windows/guildsettingswindow.cpp
index e3b66f7..8836575 100644
--- a/windows/guildsettingswindow.cpp
+++ b/windows/guildsettingswindow.cpp
@@ -1,6 +1,5 @@
#include "guildsettingswindow.hpp"
#include "../abaddon.hpp"
-#include "../components/inotifyswitched.hpp"
GuildSettingsWindow::GuildSettingsWindow(Snowflake id)
: m_main(Gtk::ORIENTATION_VERTICAL)
@@ -42,11 +41,6 @@ GuildSettingsWindow::GuildSettingsWindow(Snowflake id)
m_switcher.set_margin_top(10);
m_switcher.show();
- m_stack.property_visible_child().signal_changed().connect([this]() {
- if (auto *w = dynamic_cast<INotifySwitched *>(m_stack.property_visible_child().get_value()))
- w->on_switched_to();
- });
-
m_pane_info.show();
m_pane_members.show();
m_pane_roles.show();
diff --git a/windows/profile/mutualfriendspane.cpp b/windows/profile/mutualfriendspane.cpp
index 7d30453..5e6120a 100644
--- a/windows/profile/mutualfriendspane.cpp
+++ b/windows/profile/mutualfriendspane.cpp
@@ -34,6 +34,7 @@ MutualFriendItem::MutualFriendItem(const UserData &user)
MutualFriendsPane::MutualFriendsPane(Snowflake id)
: UserID(id) {
+ signal_map().connect(sigc::mem_fun(*this, &MutualFriendsPane::OnMap));
add(m_list);
show_all_children();
}
@@ -49,7 +50,7 @@ void MutualFriendsPane::OnFetchRelationships(const std::vector<UserData> &users)
}
}
-void MutualFriendsPane::on_switched_to() {
+void MutualFriendsPane::OnMap() {
if (m_requested) return;
m_requested = true;
diff --git a/windows/profile/mutualfriendspane.hpp b/windows/profile/mutualfriendspane.hpp
index 10daa39..764dee9 100644
--- a/windows/profile/mutualfriendspane.hpp
+++ b/windows/profile/mutualfriendspane.hpp
@@ -1,6 +1,5 @@
#pragma once
#include <gtkmm.h>
-#include "../../components/inotifyswitched.hpp"
#include "../../discord/objects.hpp"
class MutualFriendItem : public Gtk::Box {
@@ -12,14 +11,14 @@ private:
Gtk::Label m_name;
};
-class MutualFriendsPane : public Gtk::ScrolledWindow, public INotifySwitched {
+class MutualFriendsPane : public Gtk::ScrolledWindow {
public:
MutualFriendsPane(Snowflake id);
Snowflake UserID;
private:
- void on_switched_to() override;
+ void OnMap();
bool m_requested = false;
diff --git a/windows/profilewindow.cpp b/windows/profilewindow.cpp
index 2e41692..d0fefc7 100644
--- a/windows/profilewindow.cpp
+++ b/windows/profilewindow.cpp
@@ -1,6 +1,5 @@
#include "profilewindow.hpp"
#include "../abaddon.hpp"
-#include "../components/inotifyswitched.hpp"
ProfileWindow::ProfileWindow(Snowflake user_id)
: ID(user_id)
@@ -71,11 +70,6 @@ ProfileWindow::ProfileWindow(Snowflake user_id)
m_switcher.set_halign(Gtk::ALIGN_START);
m_switcher.set_hexpand(true);
- m_stack.property_visible_child().signal_changed().connect([this]() {
- if (auto *w = dynamic_cast<INotifySwitched *>(m_stack.property_visible_child().get_value()))
- w->on_switched_to();
- });
-
m_stack.add(m_pane_info, "info", "User Info");
m_stack.add(m_pane_guilds, "guilds", "Mutual Servers");
m_stack.add(m_pane_friends, "friends", "Mutual Friends");