summaryrefslogtreecommitdiff
path: root/src/windows
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2022-08-12 18:35:58 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2022-08-12 18:35:58 -0400
commit6a5ecb4d9584f7276cf1d592c95811a66943f61c (patch)
tree2c09268db37461ce9e1882789183c508bb36dd4a /src/windows
parentdc28eae95a46c3079fcc76b3425ffa37844dd37d (diff)
parentf60cea2216dd9677cb9105364cdaa778a0c187db (diff)
downloadabaddon-portaudio-6a5ecb4d9584f7276cf1d592c95811a66943f61c.tar.gz
abaddon-portaudio-6a5ecb4d9584f7276cf1d592c95811a66943f61c.zip
Merge branch 'attachments'
Diffstat (limited to 'src/windows')
-rw-r--r--src/windows/guildsettings/memberspane.cpp2
-rw-r--r--src/windows/mainwindow.cpp17
-rw-r--r--src/windows/mainwindow.hpp3
3 files changed, 21 insertions, 1 deletions
diff --git a/src/windows/guildsettings/memberspane.cpp b/src/windows/guildsettings/memberspane.cpp
index 34650ad..973e380 100644
--- a/src/windows/guildsettings/memberspane.cpp
+++ b/src/windows/guildsettings/memberspane.cpp
@@ -204,7 +204,7 @@ void GuildSettingsMembersPaneInfo::SetUser(Snowflake user_id) {
auto member = *discord.GetMember(user_id, GuildID);
member.User = discord.GetUser(user_id);
- m_bot.set_visible(member.User->IsBot.has_value() && *member.User->IsBot);
+ m_bot.set_visible(member.User->IsABot());
m_id.set_text("User ID: " + std::to_string(user_id));
m_created.set_text("Account created: " + user_id.GetLocalTimestamp());
diff --git a/src/windows/mainwindow.cpp b/src/windows/mainwindow.cpp
index a6a17c5..17edfa3 100644
--- a/src/windows/mainwindow.cpp
+++ b/src/windows/mainwindow.cpp
@@ -76,6 +76,7 @@ MainWindow::MainWindow()
add(m_main_box);
SetupMenu();
+ SetupDND();
}
void MainWindow::UpdateComponents() {
@@ -350,6 +351,22 @@ void MainWindow::SetupMenu() {
#endif
}
+void MainWindow::SetupDND() {
+ std::vector<Gtk::TargetEntry> targets;
+ targets.emplace_back("text/uri-list", Gtk::TargetFlags(0), 0);
+ drag_dest_set(targets, Gtk::DEST_DEFAULT_DROP | Gtk::DEST_DEFAULT_MOTION | Gtk::DEST_DEFAULT_HIGHLIGHT, Gdk::DragAction::ACTION_COPY);
+ signal_drag_data_received().connect([this](const Glib::RefPtr<Gdk::DragContext> &ctx, int x, int y, const Gtk::SelectionData &selection, guint info, guint time) {
+ HandleDroppedURIs(selection);
+ });
+}
+
+void MainWindow::HandleDroppedURIs(const Gtk::SelectionData &selection) {
+ for (const auto &uri : selection.get_uris()) {
+ // not using Glib::get_filename_for_uri or whatever because the conversion is BAD (on windows at least)
+ m_chat.AddAttachment(Gio::File::create_for_uri(uri));
+ }
+}
+
MainWindow::type_signal_action_connect MainWindow::signal_action_connect() {
return m_signal_action_connect;
}
diff --git a/src/windows/mainwindow.hpp b/src/windows/mainwindow.hpp
index e67f6d2..b5b6fc1 100644
--- a/src/windows/mainwindow.hpp
+++ b/src/windows/mainwindow.hpp
@@ -39,6 +39,9 @@ public:
private:
void SetupMenu();
+ void SetupDND();
+
+ void HandleDroppedURIs(const Gtk::SelectionData &selection);
Gtk::Box m_main_box;
Gtk::Box m_content_box;