mod imp { use crate::ui; use adw::prelude::*; use adw::subclass::prelude::*; use gtk::glib; #[derive(Default)] pub struct Application; #[glib::object_subclass] impl ObjectSubclass for Application { const NAME: &'static str = "AudreyApplication"; type Type = super::Application; type ParentType = adw::Application; } impl ObjectImpl for Application {} impl ApplicationImpl for Application { fn activate(&self) { self.parent_activate(); match self.obj().active_window() { None => ui::Window::new(self.obj().as_ref()).present(), Some(win) => win.present(), } } } impl GtkApplicationImpl for Application {} impl AdwApplicationImpl for Application {} } use gtk::{gio, glib}; glib::wrapper! { pub struct Application(ObjectSubclass) @extends adw::Application, gtk::Application, gio::Application, @implements gio::ActionGroup, gio::ActionMap; } impl Default for Application { fn default() -> Self { glib::Object::builder::() .property("application-id", "eu.callcc.audrey") .property("flags", gio::ApplicationFlags::default()) .build() } } impl Application { pub fn new() -> Self { Self::default() } }