@@ -290,7 +290,7 @@ fn expand_properties_fn(props: &[PropDesc]) -> TokenStream2 {
290
290
}
291
291
} ) ;
292
292
quote ! (
293
- fn properties ( ) -> & ' static [ glib:: ParamSpec ] {
293
+ fn auto_properties ( ) -> & ' static [ glib:: ParamSpec ] {
294
294
use glib:: once_cell:: sync:: Lazy ;
295
295
static PROPERTIES : Lazy <[ glib:: ParamSpec ; #n_props] > = Lazy :: new( || [
296
296
#( #properties_build_phase, ) *
@@ -322,7 +322,7 @@ fn expand_property_fn(props: &[PropDesc]) -> TokenStream2 {
322
322
}
323
323
} ) ;
324
324
quote ! (
325
- fn property ( & self , _obj: & Self :: Type , _id: usize , pspec: & glib:: ParamSpec ) -> glib:: Value {
325
+ fn auto_property ( & self , _obj: & Self :: Type , _id: usize , pspec: & glib:: ParamSpec ) -> glib:: Value {
326
326
match pspec. name( ) {
327
327
#( #match_branch_get, ) *
328
328
p => unreachable!( "Invalid property {}" , p)
@@ -355,7 +355,7 @@ fn expand_set_property_fn(props: &[PropDesc]) -> TokenStream2 {
355
355
}
356
356
} ) ;
357
357
quote ! (
358
- fn set_property ( & self , _obj: & Self :: Type , _id: usize , value: & glib:: Value , pspec: & glib:: ParamSpec ) {
358
+ fn auto_set_property ( & self , _obj: & Self :: Type , _id: usize , value: & glib:: Value , pspec: & glib:: ParamSpec ) {
359
359
match pspec. name( ) {
360
360
#( #match_branch_set, ) *
361
361
p => unreachable!( "Invalid property {}" , p)
@@ -470,6 +470,7 @@ fn expand_getset_properties_impl(imp_type_ident: &syn::Ident, props: &[PropDesc]
470
470
pub fn impl_derive_props ( input : PropsMacroInput ) -> TokenStream {
471
471
let struct_ident = & input. ident ;
472
472
let struct_ident_ext = format_ident ! ( "{}Ext" , & input. ident) ;
473
+ let struct_ident_props = format_ident ! ( "{}AutoProps" , & input. ident) ;
473
474
let wrapper_type = quote ! ( <#struct_ident as glib:: subclass:: types:: ObjectSubclass >:: Type ) ;
474
475
let fn_properties = expand_properties_fn ( & input. props ) ;
475
476
let fn_property = expand_property_fn ( & input. props ) ;
@@ -478,7 +479,13 @@ pub fn impl_derive_props(input: PropsMacroInput) -> TokenStream {
478
479
let getset_properties_impl = expand_getset_properties_impl ( struct_ident, & input. props ) ;
479
480
let expanded = quote ! {
480
481
use glib:: { PropRead , PropWrite } ;
481
- impl ObjectImpl for #struct_ident {
482
+
483
+ pub trait #struct_ident_props: ObjectSubclass {
484
+ fn auto_properties( ) -> & ' static [ ParamSpec ] ;
485
+ fn auto_set_property( & self , _obj: & Self :: Type , _id: usize , _value: & glib:: Value , _pspec: & glib:: ParamSpec ) ;
486
+ fn auto_property( & self , _obj: & Self :: Type , _id: usize , _pspec: & glib:: ParamSpec ) -> glib:: Value ;
487
+ }
488
+ impl #struct_ident_props for #struct_ident {
482
489
#fn_properties
483
490
#fn_property
484
491
#fn_set_property
0 commit comments