mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-08 09:24:13 +00:00
26 lines
704 B
Rust
26 lines
704 B
Rust
![]() |
use gtk::{gio::SimpleAction, glib::uuid_string_random};
|
||
|
|
||
|
/// [SimpleAction](https://docs.gtk.org/gio/class.SimpleAction.html) wrapper for `Focus` action of `Browser` group
|
||
|
pub struct Focus {
|
||
|
pub gobject: SimpleAction,
|
||
|
}
|
||
|
|
||
|
impl Focus {
|
||
|
// Constructors
|
||
|
|
||
|
/// Create new `Self`
|
||
|
pub fn new() -> Self {
|
||
|
Self {
|
||
|
gobject: SimpleAction::new(&uuid_string_random(), None),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Events
|
||
|
|
||
|
/// Define callback function for
|
||
|
/// [SimpleAction::activate](https://docs.gtk.org/gio/signal.SimpleAction.activate.html) signal
|
||
|
pub fn connect_activate(&self, callback: impl Fn() + 'static) {
|
||
|
self.gobject.connect_activate(move |_, _| callback());
|
||
|
}
|
||
|
}
|