mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
create separated wrapper for reload action
This commit is contained in:
parent
baea14de95
commit
b4dee17768
16 changed files with 144 additions and 64 deletions
|
|
@ -1,8 +1,10 @@
|
|||
mod append;
|
||||
mod pin;
|
||||
mod reload;
|
||||
|
||||
use append::Append;
|
||||
use pin::Pin;
|
||||
use reload::Reload;
|
||||
|
||||
use gtk::{
|
||||
gio::SimpleActionGroup,
|
||||
|
|
@ -16,6 +18,7 @@ pub struct Action {
|
|||
// Actions
|
||||
append: Rc<Append>,
|
||||
pin: Rc<Pin>,
|
||||
reload: Rc<Reload>,
|
||||
// Group
|
||||
id: GString,
|
||||
gobject: SimpleActionGroup,
|
||||
|
|
@ -29,6 +32,7 @@ impl Action {
|
|||
// Init actions
|
||||
let append = Rc::new(Append::new());
|
||||
let pin = Rc::new(Pin::new());
|
||||
let reload = Rc::new(Reload::new());
|
||||
|
||||
// Generate unique group ID
|
||||
let id = uuid_string_random();
|
||||
|
|
@ -39,11 +43,13 @@ impl Action {
|
|||
// Add action to given group
|
||||
gobject.add_action(append.gobject());
|
||||
gobject.add_action(pin.gobject());
|
||||
gobject.add_action(reload.gobject());
|
||||
|
||||
// Done
|
||||
Self {
|
||||
append,
|
||||
pin,
|
||||
reload,
|
||||
id,
|
||||
gobject,
|
||||
}
|
||||
|
|
@ -61,6 +67,11 @@ impl Action {
|
|||
&self.pin
|
||||
}
|
||||
|
||||
/// Get reference `Reload` action
|
||||
pub fn reload(&self) -> &Rc<Reload> {
|
||||
&self.reload
|
||||
}
|
||||
|
||||
/// Get auto-generated name for action group
|
||||
/// * useful for manual relationship with GObjects or as the `detailed_name`
|
||||
/// for [Accels](https://docs.gtk.org/gtk4/method.Application.set_accels_for_action.html) or
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue