summaryrefslogtreecommitdiff
path: root/src/components/channellist/channellisttree.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2024-01-14 20:25:50 -0500
committerouwou <26526779+ouwou@users.noreply.github.com>2024-01-14 20:25:50 -0500
commit7c8e91169ea2e5b30bf354cea9e6cdf572a5e307 (patch)
tree4d563e1f54e38c2e8bb796a68e71140e60aa3a9d /src/components/channellist/channellisttree.cpp
parent960da872bbd583a5b7ddcfdf1a90b31cebebc8e6 (diff)
downloadabaddon-portaudio-7c8e91169ea2e5b30bf354cea9e6cdf572a5e307.tar.gz
abaddon-portaudio-7c8e91169ea2e5b30bf354cea9e6cdf572a5e307.zip
save expansion state
Diffstat (limited to 'src/components/channellist/channellisttree.cpp')
-rw-r--r--src/components/channellist/channellisttree.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/components/channellist/channellisttree.cpp b/src/components/channellist/channellisttree.cpp
index 720fdd2..b9c4d3c 100644
--- a/src/components/channellist/channellisttree.cpp
+++ b/src/components/channellist/channellisttree.cpp
@@ -691,6 +691,23 @@ void ChannelListTree::UseExpansionState(const ExpansionStateRoot &root) {
ExpansionStateRoot ChannelListTree::GetExpansionState() const {
ExpansionStateRoot r;
+ auto recurse = [this](auto &self, const Gtk::TreeRow &row) -> ExpansionState {
+ ExpansionState r;
+
+ r.IsExpanded = row[m_columns.m_expanded];
+ for (auto child : row.children()) {
+ r.Children.Children[static_cast<Snowflake>(child[m_columns.m_id])] = self(self, child);
+ }
+
+ return r;
+ };
+
+ for (auto child : m_model->children()) {
+ const auto id = static_cast<Snowflake>(child[m_columns.m_id]);
+ if (static_cast<uint64_t>(id) == 0ULL) continue; // dont save DM header
+ r.Children[id] = recurse(recurse, child);
+ }
+
return r;
}