new group item, and partial logic

This commit is contained in:
Ashley Wulber 2021-12-03 13:07:08 -05:00
parent d05f517366
commit f4e9f25ba8

View file

@ -138,6 +138,14 @@ impl Window {
app_names: vec!["Firefox Web Browser".to_string()], app_names: vec!["Firefox Web Browser".to_string()],
category: "".to_string(), category: "".to_string(),
}), }),
AppGroup::new(AppGroupData {
id: 0,
name: "New Group".to_string(),
icon: "folder-new".to_string(),
mutable: true,
app_names: vec![],
category: "".to_string(),
}),
] ]
.iter() .iter()
.for_each(|group| { .for_each(|group| {
@ -200,6 +208,12 @@ impl Window {
// on activation change the group filter model to use the app names, and category // on activation change the group filter model to use the app names, and category
group_grid_view.connect_activate(glib::clone!(@weak app_filter_model => move |grid_view, position| { group_grid_view.connect_activate(glib::clone!(@weak app_filter_model => move |grid_view, position| {
// if last item in the model, don't change filter, instead show dialog for adding new group!
if position == grid_view.model().unwrap().n_items() - 1 {
println!("TODO: launch action to show the Add/Edit Group Window");
return;
};
// update the application filter
let model = grid_view.model().unwrap(); let model = grid_view.model().unwrap();
let app_info = model let app_info = model
.item(position) .item(position)