summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2022-04-21 14:19:21 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2022-04-21 14:19:21 -0400
commit2dab59547617f7830a4fecd3de380396b47de33f (patch)
treeb00e8813d1333873ddaa602d176b466a530a7c16 /src
parenta98967fccccfcddaffb3d61023a0224ea646d685 (diff)
downloadabaddon-portaudio-2dab59547617f7830a4fecd3de380396b47de33f.tar.gz
abaddon-portaudio-2dab59547617f7830a4fecd3de380396b47de33f.zip
add open dm in new tab
Diffstat (limited to 'src')
-rw-r--r--src/components/channels.cpp8
-rw-r--r--src/components/channels.hpp4
-rw-r--r--src/components/channeltabswitcherhandy.cpp2
3 files changed, 13 insertions, 1 deletions
diff --git a/src/components/channels.cpp b/src/components/channels.cpp
index 929eeb8..6e72725 100644
--- a/src/components/channels.cpp
+++ b/src/components/channels.cpp
@@ -19,6 +19,7 @@ ChannelList::ChannelList()
, m_menu_channel_mark_as_read("Mark as _Read", true)
#ifdef WITH_LIBHANDY
, m_menu_channel_open_tab("Open in New _Tab", true)
+ , m_menu_dm_open_tab("Open in New _Tab", true)
#endif
, m_menu_dm_copy_id("_Copy ID", true)
, m_menu_dm_close("") // changes depending on if group or not
@@ -182,6 +183,13 @@ ChannelList::ChannelList()
else
discord.MuteChannel(id, NOOP_CALLBACK);
});
+#ifdef WITH_LIBHANDY
+ m_menu_dm_open_tab.signal_activate().connect([this] {
+ const auto id = static_cast<Snowflake>((*m_model->get_iter(m_path_for_menu))[m_columns.m_id]);
+ m_signal_action_open_new_tab.emit(id);
+ });
+ m_menu_dm.append(m_menu_dm_open_tab);
+#endif
m_menu_dm.append(m_menu_dm_toggle_mute);
m_menu_dm.append(m_menu_dm_close);
m_menu_dm.append(m_menu_dm_copy_id);
diff --git a/src/components/channels.hpp b/src/components/channels.hpp
index e8032af..63d5a6d 100644
--- a/src/components/channels.hpp
+++ b/src/components/channels.hpp
@@ -130,6 +130,10 @@ protected:
Gtk::MenuItem m_menu_dm_close;
Gtk::MenuItem m_menu_dm_toggle_mute;
+#ifdef WITH_LIBHANDY
+ Gtk::MenuItem m_menu_dm_open_tab;
+#endif
+
Gtk::Menu m_menu_thread;
Gtk::MenuItem m_menu_thread_copy_id;
Gtk::MenuItem m_menu_thread_leave;
diff --git a/src/components/channeltabswitcherhandy.cpp b/src/components/channeltabswitcherhandy.cpp
index e359896..a9d2aef 100644
--- a/src/components/channeltabswitcherhandy.cpp
+++ b/src/components/channeltabswitcherhandy.cpp
@@ -49,7 +49,7 @@ void ChannelTabSwitcherHandy::AddChannelTab(Snowflake id) {
auto *dummy = Gtk::make_managed<Gtk::Box>(); // minimal
auto *page = hdy_tab_view_append(m_tab_view, GTK_WIDGET(dummy->gobj()));
- hdy_tab_page_set_title(page, ("#" + *channel->Name).c_str());
+ hdy_tab_page_set_title(page, channel->GetDisplayName().c_str());
hdy_tab_page_set_tooltip(page, nullptr);
m_pages[id] = page;