From 722ad595606f0ba96f9f6030f7082c2995d2f7a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 6 Nov 2024 10:19:15 +0200 Subject: [PATCH] glib: Also check for subtypes in `Object::has_property_with_type()` --- glib/src/object.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/glib/src/object.rs b/glib/src/object.rs index 9d722b4e7e33..a9d8b87c2261 100644 --- a/glib/src/object.rs +++ b/glib/src/object.rs @@ -3328,10 +3328,11 @@ pub unsafe trait ObjectClassExt { } // rustdoc-stripper-ignore-next - /// Check if the object class has a property `property_name` of the given `type_`. + /// Check if the object class has a property `property_name` of the given `type_` + /// or a subtype of it. fn has_property_with_type(&self, property_name: &str, type_: Type) -> bool { self.property_type(property_name) - .is_some_and(|ptype| ptype == type_) + .is_some_and(|ptype| ptype.is_a(type_)) } // rustdoc-stripper-ignore-next @@ -4274,10 +4275,11 @@ impl + IsInterface> Interface { } // rustdoc-stripper-ignore-next - /// Check if the interface has a property `property_name` of the given `type_`. + /// Check if the interface has a property `property_name` of the given `type_` + /// or a subtype of it. pub fn has_property_with_type(&self, property_name: &str, type_: Type) -> bool { self.property_type(property_name) - .is_some_and(|ptype| ptype == type_) + .is_some_and(|ptype| ptype.is_a(type_)) } // rustdoc-stripper-ignore-next