diff options
Diffstat (limited to 'windows')
-rw-r--r-- | windows/mainwindow.cpp | 24 | ||||
-rw-r--r-- | windows/mainwindow.hpp | 7 |
2 files changed, 30 insertions, 1 deletions
diff --git a/windows/mainwindow.cpp b/windows/mainwindow.cpp index b6d3ca5..6565e3b 100644 --- a/windows/mainwindow.cpp +++ b/windows/mainwindow.cpp @@ -39,8 +39,15 @@ MainWindow::MainWindow() m_menu_file_sub.append(m_menu_file_reload_css); m_menu_file_sub.append(m_menu_file_clear_cache); + m_menu_view.set_label("View"); + m_menu_view.set_submenu(m_menu_view_sub); + m_menu_view_friends.set_label("Friends"); + m_menu_view_sub.append(m_menu_view_friends); + m_menu_view_sub.signal_popped_up().connect(sigc::mem_fun(*this, &MainWindow::OnViewSubmenuPopup)); + 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(); m_menu_discord_connect.signal_activate().connect([this] { @@ -79,6 +86,10 @@ MainWindow::MainWindow() m_signal_action_add_recipient.emit(GetChatActiveChannel()); }); + m_menu_view_friends.signal_activate().connect([this] { + m_content_stack.set_visible_child("friends"); + }); + m_content_box.set_hexpand(true); m_content_box.set_vexpand(true); m_content_box.show(); @@ -110,9 +121,15 @@ MainWindow::MainWindow() member_list->set_vexpand(true); member_list->show(); - m_content_stack.add(*chat); + m_friends.set_vexpand(true); + m_friends.set_hexpand(true); + m_friends.show(); + + m_content_stack.add(*chat, "chat"); + m_content_stack.add(m_friends, "friends"); m_content_stack.set_vexpand(true); m_content_stack.set_hexpand(true); + m_content_stack.set_visible_child("chat"); m_content_stack.show(); m_chan_content_paned.pack1(*channel_list); @@ -207,6 +224,7 @@ void MainWindow::UpdateChatActiveChannel(Snowflake id) { m_chat.SetActiveChannel(id); m_members.SetActiveChannel(id); m_channel_list.SetActiveChannel(id); + m_content_stack.set_visible_child("chat"); } Snowflake MainWindow::GetChatActiveChannel() const { @@ -258,6 +276,10 @@ void MainWindow::OnDiscordSubmenuPopup(const Gdk::Rectangle *flipped_rect, const m_menu_discord_add_recipient.set_visible(channel->Type == ChannelType::GROUP_DM); } +void MainWindow::OnViewSubmenuPopup(const Gdk::Rectangle *flipped_rect, const Gdk::Rectangle *final_rect, bool flipped_x, bool flipped_y) { + m_menu_view_friends.set_sensitive(Abaddon::Get().GetDiscordClient().IsStarted()); +} + ChannelList *MainWindow::GetChannelList() { return &m_channel_list; } diff --git a/windows/mainwindow.hpp b/windows/mainwindow.hpp index 0be4bc0..544e9a3 100644 --- a/windows/mainwindow.hpp +++ b/windows/mainwindow.hpp @@ -2,6 +2,7 @@ #include "../components/channels.hpp" #include "../components/chatwindow.hpp" #include "../components/memberlist.hpp" +#include "../components/friendslist.hpp" #include <gtkmm.h> class MainWindow : public Gtk::Window { @@ -74,6 +75,7 @@ protected: ChannelList m_channel_list; ChatWindow m_chat; MemberList m_members; + FriendsList m_friends; Gtk::Stack m_content_stack; @@ -93,4 +95,9 @@ protected: Gtk::MenuItem m_menu_file_reload_settings; Gtk::MenuItem m_menu_file_reload_css; Gtk::MenuItem m_menu_file_clear_cache; + + Gtk::MenuItem m_menu_view; + Gtk::Menu m_menu_view_sub; + Gtk::MenuItem m_menu_view_friends; + void OnViewSubmenuPopup(const Gdk::Rectangle *flipped_rect, const Gdk::Rectangle *final_rect, bool flipped_x, bool flipped_y); }; |