@@ -1750,11 +1750,13 @@ pub trait ObjectExt: ObjectType {
1750
1750
#[ doc( alias = "g_object_get_property" ) ]
1751
1751
fn property_value ( & self , property_name : & str ) -> Value ;
1752
1752
1753
+ // rustdoc-stripper-ignore-next
1754
+ /// Check if the object has a property `property_name`.
1755
+ fn has_property ( & self , property_name : & str ) -> bool ;
1756
+
1753
1757
// rustdoc-stripper-ignore-next
1754
1758
/// Check if the object has a property `property_name` of the given `type_`.
1755
- ///
1756
- /// If no type is provided then only the existence of the property is checked.
1757
- fn has_property ( & self , property_name : & str , type_ : Option < Type > ) -> bool ;
1759
+ fn has_property_with_type ( & self , property_name : & str , type_ : Type ) -> bool ;
1758
1760
1759
1761
// rustdoc-stripper-ignore-next
1760
1762
/// Get the type of the property `property_name` of this object.
@@ -2455,8 +2457,13 @@ impl<T: ObjectType> ObjectExt for T {
2455
2457
}
2456
2458
}
2457
2459
2458
- fn has_property ( & self , property_name : & str , type_ : Option < Type > ) -> bool {
2459
- self . object_class ( ) . has_property ( property_name, type_)
2460
+ fn has_property ( & self , property_name : & str ) -> bool {
2461
+ self . object_class ( ) . has_property ( property_name)
2462
+ }
2463
+
2464
+ fn has_property_with_type ( & self , property_name : & str , type_ : Type ) -> bool {
2465
+ self . object_class ( )
2466
+ . has_property_with_type ( property_name, type_)
2460
2467
}
2461
2468
2462
2469
fn property_type ( & self , property_name : & str ) -> Option < Type > {
@@ -3316,16 +3323,16 @@ fn validate_signal_arguments(type_: Type, signal_query: &SignalQuery, args: &mut
3316
3323
pub unsafe trait ObjectClassExt {
3317
3324
// rustdoc-stripper-ignore-next
3318
3325
/// Check if the object class has a property `property_name` of the given `type_`.
3319
- ///
3320
- /// If no type is provided then only the existence of the property is checked.
3321
- fn has_property ( & self , property_name : & str , type_ : Option < Type > ) -> bool {
3322
- let ptype = self . property_type ( property_name) ;
3326
+ fn has_property ( & self , property_name : & str ) -> bool {
3327
+ self . find_property ( property_name) . is_some ( )
3328
+ }
3323
3329
3324
- match ( ptype, type_) {
3325
- ( None , _) => false ,
3326
- ( Some ( _) , None ) => true ,
3327
- ( Some ( ptype) , Some ( type_) ) => ptype == type_,
3328
- }
3330
+ // rustdoc-stripper-ignore-next
3331
+ /// Check if the object class has a property `property_name` of the given `type_`
3332
+ /// or a subtype of it.
3333
+ fn has_property_with_type ( & self , property_name : & str , type_ : Type ) -> bool {
3334
+ self . property_type ( property_name)
3335
+ . is_some_and ( |ptype| ptype. is_a ( type_) )
3329
3336
}
3330
3337
3331
3338
// rustdoc-stripper-ignore-next
@@ -4262,17 +4269,17 @@ impl<T: IsInterface> Interface<T> {
4262
4269
4263
4270
impl < T : IsA < Object > + IsInterface > Interface < T > {
4264
4271
// rustdoc-stripper-ignore-next
4265
- /// Check if this interface has a property `property_name` of the given `type_`.
4266
- ///
4267
- /// If no type is provided then only the existence of the property is checked.
4268
- pub fn has_property ( & self , property_name : & str , type_ : Option < Type > ) -> bool {
4269
- let ptype = self . property_type ( property_name) ;
4272
+ /// Check if the interface has a property `property_name` of the given `type_`.
4273
+ pub fn has_property ( & self , property_name : & str ) -> bool {
4274
+ self . find_property ( property_name) . is_some ( )
4275
+ }
4270
4276
4271
- match ( ptype, type_) {
4272
- ( None , _) => false ,
4273
- ( Some ( _) , None ) => true ,
4274
- ( Some ( ptype) , Some ( type_) ) => ptype == type_,
4275
- }
4277
+ // rustdoc-stripper-ignore-next
4278
+ /// Check if the interface has a property `property_name` of the given `type_`
4279
+ /// or a subtype of it.
4280
+ pub fn has_property_with_type ( & self , property_name : & str , type_ : Type ) -> bool {
4281
+ self . property_type ( property_name)
4282
+ . is_some_and ( |ptype| ptype. is_a ( type_) )
4276
4283
}
4277
4284
4278
4285
// rustdoc-stripper-ignore-next
0 commit comments