2024-10-29 13:02:29 +00:00
|
|
|
mod imp {
|
|
|
|
use crate::ui;
|
|
|
|
use adw::prelude::*;
|
|
|
|
use adw::subclass::prelude::*;
|
|
|
|
use gtk::glib;
|
2024-10-29 12:01:42 +00:00
|
|
|
|
2024-10-29 13:02:29 +00:00
|
|
|
#[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;
|
2024-10-29 12:01:42 +00:00
|
|
|
}
|
|
|
|
|
2024-10-29 13:02:29 +00:00
|
|
|
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(),
|
|
|
|
}
|
|
|
|
}
|
2024-10-29 12:01:42 +00:00
|
|
|
}
|
|
|
|
|
2024-10-29 13:02:29 +00:00
|
|
|
impl GtkApplicationImpl for Application {}
|
|
|
|
|
|
|
|
impl AdwApplicationImpl for Application {}
|
2024-10-29 12:01:42 +00:00
|
|
|
}
|
|
|
|
|
2024-10-29 13:02:29 +00:00
|
|
|
use gtk::{gio, glib};
|
|
|
|
|
2024-10-29 12:01:42 +00:00
|
|
|
glib::wrapper! {
|
2024-10-29 13:02:29 +00:00
|
|
|
pub struct Application(ObjectSubclass<imp::Application>)
|
2024-10-29 12:01:42 +00:00
|
|
|
@extends adw::Application, gtk::Application, gio::Application,
|
|
|
|
@implements gio::ActionGroup, gio::ActionMap;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Application {
|
|
|
|
pub fn new() -> Self {
|
2024-10-29 13:02:29 +00:00
|
|
|
glib::Object::builder()
|
|
|
|
.property("application-id", "eu.callcc.audrey")
|
|
|
|
.property("flags", gio::ApplicationFlags::default())
|
|
|
|
.build()
|
2024-10-29 12:01:42 +00:00
|
|
|
}
|
|
|
|
}
|