pub mod ffi { use gtk::glib; #[repr(C)] pub struct AudreyUiWindow { parent_instance: adw::ffi::AdwApplicationWindow, } #[repr(C)] pub struct AudreyUiWindowClass { parent_class: adw::ffi::AdwApplicationWindowClass, } extern "C" { pub fn audrey_ui_window_get_type() -> glib::ffi::GType; pub fn audrey_ui_window_new(app: *mut gtk::ffi::GtkApplication) -> *mut AudreyUiWindow; pub fn audrey_ui_window_get_playbin( self_: *mut AudreyUiWindow, ) -> *mut crate::playbin::ffi::AudreyPlaybin; } } use adw::prelude::*; use glib::translate::{from_glib_none, ToGlibPtr}; use gtk::{gio, glib}; glib::wrapper! { pub struct Window(Object) @extends adw::ApplicationWindow, gtk::ApplicationWindow, gtk::Window, gtk::Widget, @implements gio::ActionGroup, gio::ActionMap, gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager; match fn { type_ => || ffi::audrey_ui_window_get_type(), } } impl Window { pub fn new(app: &impl IsA) -> Self { unsafe { from_glib_none(ffi::audrey_ui_window_new(app.as_ref().to_glib_none().0)) } } pub fn playbin(&self) -> Option { unsafe { from_glib_none(ffi::audrey_ui_window_get_playbin(self.to_glib_none().0)) } } }