diff --git a/src/analysis/properties.rs b/src/analysis/properties.rs index 683aa765c..95fbe2bc5 100644 --- a/src/analysis/properties.rs +++ b/src/analysis/properties.rs @@ -234,7 +234,8 @@ fn analyze_property( let has_setter = setter_func.is_some_and(|s| matches!(s.status, GStatus::Generate | GStatus::Manual)); - let getter = if readable && !has_getter { + let getter = if readable && (!has_getter || prop.version < getter_func.and_then(|g| g.version)) + { if let Ok(rust_type) = RustType::builder(env, prop.typ) .direction(library::ParameterDirection::Out) .try_build() @@ -245,6 +246,17 @@ fn analyze_property( imports.add("glib::prelude::*"); } + let mut getter_version = prop_version; + if has_getter { + let getter = getter_func.unwrap(); + get_func_name = getter.new_name.as_ref().unwrap_or(&getter.name).to_string(); + get_prop_name = Some(getter.name.clone()); + getter_version = getter.version.map(|mut g| { + g.as_opposite(); + g + }); + } + Some(Property { name: name.clone(), var_name: nameutil::mangle_keywords(&*name_for_func).into_owned(), @@ -257,14 +269,15 @@ fn analyze_property( set_in_ref_mode, set_bound: None, bounds: Bounds::default(), - version: prop_version, + version: getter_version, deprecated_version: prop.deprecated_version, }) } else { None }; - let setter = if writable && !has_setter { + let setter = if writable && (!has_setter || prop.version < setter_func.and_then(|s| s.version)) + { if let Ok(rust_type) = RustType::builder(env, prop.typ) .direction(library::ParameterDirection::In) .try_build() @@ -286,6 +299,17 @@ fn analyze_property( } } + let mut setter_version = prop_version; + if has_setter { + let setter = setter_func.unwrap(); + set_func_name = setter.new_name.as_ref().unwrap_or(&setter.name).to_string(); + set_prop_name = Some(setter.name.clone()); + setter_version = setter.version.map(|mut s| { + s.as_opposite(); + s + }); + } + Some(Property { name: name.clone(), var_name: nameutil::mangle_keywords(&*name_for_func).into_owned(), @@ -298,7 +322,7 @@ fn analyze_property( set_in_ref_mode, set_bound, bounds: Bounds::default(), - version: prop_version, + version: setter_version, deprecated_version: prop.deprecated_version, }) } else {