initial support for app library

This commit is contained in:
Ashley Wulber 2022-01-19 16:00:02 -05:00
parent 6ed9fdc9cd
commit 9273ea91e8
8 changed files with 154 additions and 171 deletions

View file

@ -1,18 +1,13 @@
use glib::signal::Inhibit;
use crate::window_inner::AppLibraryWindowInner;
use gtk4::glib;
use gtk4::subclass::prelude::*;
use gtk4::SearchEntry;
use once_cell::sync::OnceCell;
use crate::app_grid::AppGrid;
use crate::group_grid::GroupGrid;
// Object holding the state
#[derive(Default)]
pub struct AppLibraryWindow {
pub entry: OnceCell<SearchEntry>,
pub app_grid: OnceCell<AppGrid>,
pub group_grid: OnceCell<GroupGrid>,
pub(super) inner: OnceCell<AppLibraryWindowInner>,
}
// The central trait for subclassing a GObject
@ -31,14 +26,7 @@ impl ObjectImpl for AppLibraryWindow {}
impl WidgetImpl for AppLibraryWindow {}
// Trait shared by all windows
impl WindowImpl for AppLibraryWindow {
fn close_request(&self, window: &Self::Type) -> Inhibit {
let imp = AppLibraryWindow::from_instance(window);
imp.group_grid.get().unwrap().store_data();
// Pass close request on to the parent
self.parent_close_request(window)
}
}
impl WindowImpl for AppLibraryWindow {}
// Trait shared by all application
impl ApplicationWindowImpl for AppLibraryWindow {}