use gtk::{gio::SimpleAction, glib::uuid_string_random, prelude::ActionExt};
pub struct Ident {
gobject: SimpleAction,
}
impl Ident {
pub fn new() -> Self {
Self {
gobject: SimpleAction::new(&uuid_string_random(), None),
}
}
pub fn activate(&self) {
self.gobject.activate(None);
}
pub fn connect_activate(&self, callback: impl Fn() + 'static) {
self.gobject.connect_activate(move |_, _| callback());
}
pub fn gobject(&self) -> &SimpleAction {
&self.gobject
}
}