mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
draft focus out action
This commit is contained in:
parent
44c669389a
commit
e606ef5fa9
5 changed files with 48 additions and 2 deletions
25
src/app/browser/action/focus.rs
Normal file
25
src/app/browser/action/focus.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
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());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue