give name to gobject variables

This commit is contained in:
yggverse 2024-12-14 06:50:30 +02:00
parent 702269f1f1
commit a1617b2b1b
35 changed files with 213 additions and 209 deletions

View file

@ -11,7 +11,7 @@ const DEFAULT_STATE: i32 = -1;
/// [SimpleAction](https://docs.gtk.org/gio/class.SimpleAction.html) wrapper for `Source` action of `Window` group
pub struct Source {
pub gobject: SimpleAction,
pub simple_action: SimpleAction,
}
impl Source {
@ -20,7 +20,7 @@ impl Source {
/// Create new `Self`
pub fn new() -> Self {
Self {
gobject: SimpleAction::new_stateful(
simple_action: SimpleAction::new_stateful(
&uuid_string_random(),
None,
&DEFAULT_STATE.to_variant(),
@ -33,7 +33,7 @@ impl Source {
/// Change action [state](https://docs.gtk.org/gio/method.SimpleAction.set_state.html)
/// * set `DEFAULT_STATE` on `None`
pub fn change_state(&self, state: Option<i32>) {
self.gobject.change_state(
self.simple_action.change_state(
&match state {
Some(value) => value,
None => DEFAULT_STATE,
@ -47,7 +47,7 @@ impl Source {
/// Define callback function for
/// [SimpleAction::activate](https://docs.gtk.org/gio/signal.SimpleAction.activate.html) signal
pub fn connect_activate(&self, callback: impl Fn(Option<i32>) + 'static) {
self.gobject.connect_activate(move |this, _| {
self.simple_action.connect_activate(move |this, _| {
let state = this
.state()
.expect("State value required")