mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
drop Arc from SimpleAction #1
This commit is contained in:
parent
08ad677ba4
commit
920721412e
40 changed files with 162 additions and 175 deletions
|
|
@ -2,8 +2,6 @@
|
|||
// and replace them with objects (to follow encapsulation for children mods)
|
||||
// @TODO find alternative implementation, if exist for GTK 4
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use gtk::{
|
||||
gio::SimpleAction,
|
||||
glib::{gformat, uuid_string_random, GString, VariantTy},
|
||||
|
|
@ -12,14 +10,14 @@ use gtk::{
|
|||
|
||||
pub struct Action {
|
||||
group: GString,
|
||||
simple: Arc<SimpleAction>,
|
||||
simple: SimpleAction,
|
||||
}
|
||||
|
||||
impl Action {
|
||||
// Construct
|
||||
pub fn new(group: &str, is_enabled: bool, parameter_type: Option<&VariantTy>) -> Self {
|
||||
// Create random action name as no static values should be in use
|
||||
let simple = Arc::new(SimpleAction::new(&uuid_string_random(), parameter_type));
|
||||
let simple = SimpleAction::new(&uuid_string_random(), parameter_type);
|
||||
simple.set_enabled(is_enabled);
|
||||
|
||||
// Assign action to the group
|
||||
|
|
@ -36,7 +34,7 @@ impl Action {
|
|||
}
|
||||
|
||||
// App mods work with simple and system-wide data types, let them take it
|
||||
pub fn simple(&self) -> Arc<SimpleAction> {
|
||||
pub fn simple(&self) -> SimpleAction {
|
||||
self.simple.clone()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue