mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
give name to gobject variables
This commit is contained in:
parent
702269f1f1
commit
a1617b2b1b
35 changed files with 213 additions and 209 deletions
|
|
@ -2,7 +2,7 @@ use gtk::{gio::SimpleAction, glib::uuid_string_random, prelude::ActionExt};
|
|||
|
||||
/// [SimpleAction](https://docs.gtk.org/gio/class.SimpleAction.html) wrapper for `Focus` action of `Browser` group
|
||||
pub struct Focus {
|
||||
pub gobject: SimpleAction,
|
||||
pub simple_action: SimpleAction,
|
||||
}
|
||||
|
||||
impl Focus {
|
||||
|
|
@ -11,7 +11,7 @@ impl Focus {
|
|||
/// Create new `Self`
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
gobject: SimpleAction::new(&uuid_string_random(), None),
|
||||
simple_action: SimpleAction::new(&uuid_string_random(), None),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ impl Focus {
|
|||
/// Emit [activate](https://docs.gtk.org/gio/signal.SimpleAction.activate.html) signal
|
||||
/// with formatted for this action [Variant](https://docs.gtk.org/glib/struct.Variant.html) value
|
||||
pub fn activate(&self) {
|
||||
self.gobject.activate(None); // @TODO custom value
|
||||
self.simple_action.activate(None); // @TODO custom value
|
||||
}
|
||||
|
||||
// Events
|
||||
|
|
@ -28,6 +28,6 @@ impl Focus {
|
|||
/// 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());
|
||||
self.simple_action.connect_activate(move |_, _| callback());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue