Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "SimpleAction: take state by value" #1011

Merged
merged 1 commit into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions gio/Gir.toml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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