audrey/src/application.rs

37 lines
865 B
Rust
Raw Normal View History

2024-10-29 12:01:42 +00:00
use gtk::{glib, gio};
pub mod ffi {
#[repr(C)]
pub struct AudreyApplication {
pub parent_instance: adw::ffi::AdwApplication,
}
#[repr(C)]
pub struct AudreyApplicationClass {
pub parent_class: adw::ffi::AdwApplicationClass,
}
}
extern "C" {
fn audrey_application_get_type() -> glib::ffi::GType;
fn audrey_application_new() -> *mut ffi::AudreyApplication;
}
glib::wrapper! {
pub struct Application(Object<ffi::AudreyApplication, ffi::AudreyApplicationClass>)
@extends adw::Application, gtk::Application, gio::Application,
@implements gio::ActionGroup, gio::ActionMap;
match fn {
type_ => || audrey_application_get_type(),
}
}
impl Application {
pub fn new() -> Self {
unsafe {
glib::translate::from_glib_full(audrey_application_new())
}
}
}