gtk: use ToVariant for Actionable::set_action_target
Fixes
// Take a look at the license at the top of the repository in the LICENSE file.
use crate::Actionable;
-use glib::object::IsA;
use glib::translate::*;
-use libc::c_char;
+use glib::{IsA, ToVariant};
// rustdoc-stripper-ignore-next
/// Trait containing manually implemented methods of [`Actionable`](crate::Actionable).
pub trait ActionableExtManual: 'static {
#[doc(alias = "gtk_actionable_set_action_target")]
- fn set_action_target(&self, string: &str);
+ #[doc(alias = "gtk_actionable_set_action_target_value")]
+ fn set_action_target(&self, target: Option<&impl ToVariant>);
}
impl<O: IsA<Actionable>> ActionableExtManual for O {
- fn set_action_target(&self, string: &str) {
- let string: Stash<*const c_char, _> = string.to_glib_none();
+ fn set_action_target(&self, target: Option<&impl ToVariant>) {
unsafe {
- ffi::gtk_actionable_set_action_target(
+ ffi::gtk_actionable_set_action_target_value(
self.as_ref().to_glib_none().0,
- b"%s\0".as_ptr() as *const c_char,
- string.0,
+ target.map(|v| v.to_variant()).to_glib_none().0,
);
}
}
