mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-06 20:15:19 +03:00
make ChannelList directly subclass a container
This commit is contained in:
@@ -8,8 +8,9 @@
|
||||
#include "statusindicator.hpp"
|
||||
|
||||
ChannelList::ChannelList()
|
||||
: m_model(Gtk::TreeStore::create(m_columns))
|
||||
, m_main(Gtk::manage(new Gtk::ScrolledWindow)) {
|
||||
: Glib::ObjectBase(typeid(ChannelList))
|
||||
, Gtk::ScrolledWindow()
|
||||
, m_model(Gtk::TreeStore::create(m_columns)) {
|
||||
const auto cb = [this](const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *column) {
|
||||
auto row = *m_model->get_iter(path);
|
||||
if (row[m_columns.m_expanded]) {
|
||||
@@ -38,8 +39,7 @@ ChannelList::ChannelList()
|
||||
|
||||
m_view.show();
|
||||
|
||||
m_main->add(m_view);
|
||||
m_main->show_all();
|
||||
add(m_view);
|
||||
|
||||
auto *column = Gtk::manage(new Gtk::TreeView::Column("display"));
|
||||
auto *renderer = Gtk::manage(new CellRendererChannels);
|
||||
@@ -51,10 +51,6 @@ ChannelList::ChannelList()
|
||||
m_view.append_column(*column);
|
||||
}
|
||||
|
||||
Gtk::Widget *ChannelList::GetRoot() const {
|
||||
return m_main;
|
||||
}
|
||||
|
||||
void ChannelList::UpdateListing() {
|
||||
m_model->clear();
|
||||
|
||||
|
||||
@@ -81,10 +81,9 @@ private:
|
||||
Glib::Property<bool> m_property_expanded; // category
|
||||
};
|
||||
|
||||
class ChannelList {
|
||||
class ChannelList : public Gtk::ScrolledWindow {
|
||||
public:
|
||||
ChannelList();
|
||||
Gtk::Widget *GetRoot() const;
|
||||
void UpdateListing();
|
||||
void UpdateNewGuild(Snowflake id);
|
||||
void UpdateRemoveGuild(Snowflake id);
|
||||
@@ -97,7 +96,6 @@ public:
|
||||
void SetActiveChannel(Snowflake id);
|
||||
|
||||
protected:
|
||||
Gtk::ScrolledWindow *m_main;
|
||||
Gtk::TreeView m_view;
|
||||
|
||||
class ModelColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
|
||||
@@ -100,7 +100,6 @@ MainWindow::MainWindow()
|
||||
m_main_box.add(m_content_box);
|
||||
m_main_box.show();
|
||||
|
||||
auto *channel_list = m_channel_list.GetRoot();
|
||||
auto *member_list = m_members.GetRoot();
|
||||
auto *chat = m_chat.GetRoot();
|
||||
|
||||
@@ -108,9 +107,9 @@ MainWindow::MainWindow()
|
||||
chat->set_hexpand(true);
|
||||
chat->show();
|
||||
|
||||
channel_list->set_vexpand(true);
|
||||
channel_list->set_size_request(-1, -1);
|
||||
channel_list->show();
|
||||
m_channel_list.set_vexpand(true);
|
||||
m_channel_list.set_size_request(-1, -1);
|
||||
m_channel_list.show();
|
||||
|
||||
member_list->set_vexpand(true);
|
||||
member_list->show();
|
||||
@@ -126,10 +125,10 @@ MainWindow::MainWindow()
|
||||
m_content_stack.set_visible_child("chat");
|
||||
m_content_stack.show();
|
||||
|
||||
m_chan_content_paned.pack1(*channel_list);
|
||||
m_chan_content_paned.pack1(m_channel_list);
|
||||
m_chan_content_paned.pack2(m_content_members_paned);
|
||||
m_chan_content_paned.child_property_shrink(*channel_list) = false;
|
||||
m_chan_content_paned.child_property_resize(*channel_list) = false;
|
||||
m_chan_content_paned.child_property_shrink(m_channel_list) = false;
|
||||
m_chan_content_paned.child_property_resize(m_channel_list) = false;
|
||||
m_chan_content_paned.set_position(200);
|
||||
m_chan_content_paned.show();
|
||||
m_content_box.add(m_chan_content_paned);
|
||||
|
||||
Reference in New Issue
Block a user