This repository was archived by the owner on Mar 4, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +14
-25
lines changed
composite_template/example_application_window Expand file tree Collapse file tree 7 files changed +14
-25
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ glib::wrapper! {
11
11
impl SimpleApplication {
12
12
#[ allow( clippy:: new_without_default) ]
13
13
pub fn new ( ) -> Self {
14
- glib:: Object :: new ( & [
15
- ( "application-id" , & "org.gtk-rs.SimpleApplication" ) ,
16
- ( "flags" , & ApplicationFlags :: empty ( ) ) ,
17
- ] )
14
+ glib:: Object :: builder ( )
15
+ . property ( "application-id" , & "org.gtk-rs.SimpleApplication" )
16
+ . property ( "flags" , & ApplicationFlags :: empty ( ) )
17
+ . build ( )
18
18
}
19
19
}
Original file line number Diff line number Diff line change @@ -11,6 +11,6 @@ glib::wrapper! {
11
11
12
12
impl SimpleWindow {
13
13
pub fn new ( app : & SimpleApplication ) -> Self {
14
- glib:: Object :: new ( & [ ( "application" , app) ] )
14
+ glib:: Object :: builder ( ) . property ( "application" , app) . build ( )
15
15
}
16
16
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ glib::wrapper! {
11
11
12
12
impl ExampleApplicationWindow {
13
13
pub fn new < P : glib:: IsA < gtk:: Application > > ( app : & P ) -> Self {
14
- glib:: Object :: new ( & [ ( "application" , app) ] )
14
+ glib:: Object :: builder ( ) . property ( "application" , app) . build ( )
15
15
}
16
16
17
17
fn init_label ( & self ) {
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ glib::wrapper! {
15
15
impl Model {
16
16
#[ allow( clippy:: new_without_default) ]
17
17
pub fn new ( ) -> Model {
18
- glib:: Object :: new ( & [ ] )
18
+ glib:: Object :: new ( )
19
19
}
20
20
21
21
pub fn append ( & self , obj : & RowData ) {
Original file line number Diff line number Diff line change @@ -29,22 +29,8 @@ impl ObjectImpl for RowData {
29
29
use once_cell:: sync:: Lazy ;
30
30
static PROPERTIES : Lazy < Vec < glib:: ParamSpec > > = Lazy :: new ( || {
31
31
vec ! [
32
- glib:: ParamSpecString :: new(
33
- "name" ,
34
- "Name" ,
35
- "Name" ,
36
- None , // Default value
37
- glib:: ParamFlags :: READWRITE ,
38
- ) ,
39
- glib:: ParamSpecUInt :: new(
40
- "count" ,
41
- "Count" ,
42
- "Count" ,
43
- 0 ,
44
- 100 ,
45
- 0 , // Allowed range and default value
46
- glib:: ParamFlags :: READWRITE ,
47
- ) ,
32
+ glib:: ParamSpecString :: builder( "name" ) . build( ) ,
33
+ glib:: ParamSpecUInt :: builder( "count" ) . maximum( 100 ) . build( ) ,
48
34
]
49
35
} ) ;
50
36
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ glib::wrapper! {
18
18
// initial values for our two properties and then returns the new instance
19
19
impl RowData {
20
20
pub fn new ( name : & str , count : u32 ) -> RowData {
21
- glib:: Object :: new ( & [ ( "name" , & name) , ( "count" , & count) ] )
21
+ glib:: Object :: builder ( )
22
+ . property ( "name" , & name)
23
+ . property ( "count" , & count)
24
+ . build ( )
22
25
}
23
26
}
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ use syn::{parse_macro_input, DeriveInput};
75
75
///
76
76
/// impl MyWidget {
77
77
/// pub fn new() -> Self {
78
- /// glib::Object::new(&[] )
78
+ /// glib::Object::new()
79
79
/// }
80
80
/// }
81
81
/// # fn main() {}
You can’t perform that action at this time.
0 commit comments