mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55: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
|
|
@ -37,7 +37,7 @@ const DEFAULT_IS_LOAD: bool = false;
|
|||
|
||||
/// [SimpleAction](https://docs.gtk.org/gio/class.SimpleAction.html) wrapper for `Append` action of `Window` group
|
||||
pub struct Append {
|
||||
pub gobject: SimpleAction,
|
||||
pub simple_action: SimpleAction,
|
||||
}
|
||||
|
||||
impl Append {
|
||||
|
|
@ -46,7 +46,7 @@ impl Append {
|
|||
/// Create new `Self` with default action state preset
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
gobject: SimpleAction::new_stateful(
|
||||
simple_action: SimpleAction::new_stateful(
|
||||
&uuid_string_random(),
|
||||
None,
|
||||
&(
|
||||
|
|
@ -69,7 +69,7 @@ impl Append {
|
|||
pub fn activate_default_once(&self) {
|
||||
// Save current state in memory
|
||||
let (position, request, is_pinned, is_selected, is_attention, is_load) =
|
||||
state(&self.gobject);
|
||||
state(&self.simple_action);
|
||||
|
||||
// Set default state
|
||||
self.change_state(
|
||||
|
|
@ -82,7 +82,7 @@ impl Append {
|
|||
);
|
||||
|
||||
// Activate action
|
||||
self.gobject.activate(None);
|
||||
self.simple_action.activate(None);
|
||||
|
||||
// Return previous state
|
||||
self.change_state(
|
||||
|
|
@ -108,7 +108,7 @@ impl Append {
|
|||
) {
|
||||
// Save current state in memory
|
||||
let (_position, _request, _is_pinned, _is_selected, _is_attention, _is_load) =
|
||||
state(&self.gobject);
|
||||
state(&self.simple_action);
|
||||
|
||||
// Apply requested state
|
||||
self.change_state(
|
||||
|
|
@ -121,7 +121,7 @@ impl Append {
|
|||
);
|
||||
|
||||
// Activate action
|
||||
self.gobject.activate(None);
|
||||
self.simple_action.activate(None);
|
||||
|
||||
// Return previous state
|
||||
self.change_state(
|
||||
|
|
@ -144,7 +144,7 @@ impl Append {
|
|||
is_attention: bool,
|
||||
is_load: bool,
|
||||
) {
|
||||
self.gobject.change_state(
|
||||
self.simple_action.change_state(
|
||||
&(
|
||||
// Convert Option to C-based variant value
|
||||
position,
|
||||
|
|
@ -171,7 +171,7 @@ impl Append {
|
|||
&self,
|
||||
callback: impl Fn(Position, Option<String>, bool, bool, bool, bool) + 'static,
|
||||
) {
|
||||
self.gobject.connect_activate(move |this, _| {
|
||||
self.simple_action.connect_activate(move |this, _| {
|
||||
let (position, request, is_pinned, is_selected, is_attention, is_load) = state(this);
|
||||
callback(
|
||||
position,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue