Skip to content

Commit

Permalink
Merge pull request #1011 from mbiggio/wip/biggio/revert-simple-action
Browse files Browse the repository at this point in the history
Revert "SimpleAction: take state by value"
  • Loading branch information
pbor committed Feb 17, 2023
2 parents 713401d + 4d10122 commit a683a43
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
15 changes: 0 additions & 15 deletions gio/Gir.toml
Expand Up @@ -1157,21 +1157,6 @@ status = "generate"
name = "state"
#value glib::VariantTy
ignore = true
[[object.function]]
name = "new_stateful"
[[object.function.parameter]]
name = "state"
move = true
[[object.function]]
name = "set_state"
[[object.function.parameter]]
name = "value"
move = true
[[object.function]]
name = "set_state_hint"
[[object.function.parameter]]
name = "state_hint"
move = true

[[object]]
name = "Gio.SimpleIOStream"
Expand Down
2 changes: 1 addition & 1 deletion gio/src/action_map.rs
Expand Up @@ -15,7 +15,7 @@ impl<O: IsA<ActionMap>> ActionMapExtManual for O {
fn add_action_entries(&self, entries: impl IntoIterator<Item = ActionEntry<Self>>) {
for entry in entries.into_iter() {
let action = if let Some(state) = entry.state() {
SimpleAction::new_stateful(entry.name(), entry.parameter_type(), state.clone())
SimpleAction::new_stateful(entry.name(), entry.parameter_type(), state)
} else {
SimpleAction::new(entry.name(), entry.parameter_type())
};
Expand Down
12 changes: 6 additions & 6 deletions gio/src/auto/simple_action.rs
Expand Up @@ -34,13 +34,13 @@ impl SimpleAction {
pub fn new_stateful(
name: &str,
parameter_type: Option<&glib::VariantTy>,
state: glib::Variant,
state: &glib::Variant,
) -> SimpleAction {
unsafe {
from_glib_full(ffi::g_simple_action_new_stateful(
name.to_glib_none().0,
parameter_type.to_glib_none().0,
state.into_glib_ptr(),
state.to_glib_none().0,
))
}
}
Expand All @@ -53,16 +53,16 @@ impl SimpleAction {
}

#[doc(alias = "g_simple_action_set_state")]
pub fn set_state(&self, value: glib::Variant) {
pub fn set_state(&self, value: &glib::Variant) {
unsafe {
ffi::g_simple_action_set_state(self.to_glib_none().0, value.into_glib_ptr());
ffi::g_simple_action_set_state(self.to_glib_none().0, value.to_glib_none().0);
}
}

#[doc(alias = "g_simple_action_set_state_hint")]
pub fn set_state_hint(&self, state_hint: Option<glib::Variant>) {
pub fn set_state_hint(&self, state_hint: Option<&glib::Variant>) {
unsafe {
ffi::g_simple_action_set_state_hint(self.to_glib_none().0, state_hint.into_glib_ptr());
ffi::g_simple_action_set_state_hint(self.to_glib_none().0, state_hint.to_glib_none().0);
}
}

Expand Down

0 comments on commit a683a43

Please sign in to comment.