show scrollbar if >2 rows of app groups

This commit is contained in:
Ashley Wulber 2021-12-06 14:50:52 -05:00 committed by Jeremy Soller
parent ce3bcd7821
commit e160649a14
5 changed files with 102 additions and 76 deletions

View file

@ -1,3 +1,4 @@
use gtk4::ScrolledWindow;
use std::path::PathBuf;
use gtk4::glib;
@ -9,3 +10,11 @@ pub fn data_path() -> PathBuf {
path.push("data.json");
path
}
pub fn set_group_scroll_policy(scroll_window: &ScrolledWindow, group_cnt: u32) {
if scroll_window.policy().1 == gtk4::PolicyType::Never && group_cnt > 16 {
scroll_window.set_policy(gtk4::PolicyType::Never, gtk4::PolicyType::Automatic);
} else if scroll_window.policy().1 == gtk4::PolicyType::Automatic && group_cnt <= 16 {
scroll_window.set_policy(gtk4::PolicyType::Never, gtk4::PolicyType::Never);
}
}