This repository was archived by the owner on Mar 4, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 13 files changed +113
-53
lines changed
composite_template/example_application_window Expand file tree Collapse file tree 13 files changed +113
-53
lines changed Original file line number Diff line number Diff line change 37
37
- uses : actions-rs/cargo@v1
38
38
with :
39
39
command : doc
40
- args : -p atk -p atk-sys -p gdk -p gdk-sys -p gdkx11 -p gdkx11-sys -p gtk -p gtk3-macros -p gtk-sys --features dox --no-deps
40
+ args : -p atk -p atk-sys -p gdk -p gdk-sys -p gdkx11 -p gdkx11-sys -p gtk -p gtk3-macros -p gtk-sys -p gdkwayland -p gdkwayland-sys - -features dox --no-deps
41
41
- run : echo "RELEASE=$(echo '${{ github.event.release.tag_name }}' | grep -Po '(\d+)\.(\d+)')" >> ${GITHUB_ENV}
42
42
- run : echo "DEST=stable/0.15" >> ${GITHUB_ENV}
43
43
- name : Grab gtk-rs LOGO
Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ impl ApplicationImpl for SimpleApplication {
29
29
/// aksed to present itself.
30
30
fn activate ( & self , app : & Self :: Type ) {
31
31
let app = app. downcast_ref :: < super :: SimpleApplication > ( ) . unwrap ( ) ;
32
- let priv_ = SimpleApplication :: from_instance ( app) ;
33
- let window = priv_
32
+ let imp = app. imp ( ) ;
33
+ let window = imp
34
34
. window
35
35
. get ( )
36
36
. expect ( "Should always be initiliazed in gio_application_startup" ) ;
@@ -49,10 +49,9 @@ impl ApplicationImpl for SimpleApplication {
49
49
self . parent_startup ( app) ;
50
50
51
51
let app = app. downcast_ref :: < super :: SimpleApplication > ( ) . unwrap ( ) ;
52
- let priv_ = SimpleApplication :: from_instance ( app) ;
52
+ let imp = app. imp ( ) ;
53
53
let window = SimpleWindow :: new ( app) ;
54
- priv_
55
- . window
54
+ imp. window
56
55
. set ( window)
57
56
. expect ( "Failed to initialize application window" ) ;
58
57
}
Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ impl ObjectImpl for SimpleWindow {
41
41
// Connect our method `on_increment_clicked` to be called
42
42
// when the increment button is clicked.
43
43
increment. connect_clicked ( clone ! ( @weak obj => move |_| {
44
- let priv_ = SimpleWindow :: from_instance ( & obj) ;
45
- priv_ . on_increment_clicked( ) ;
44
+ let imp = obj. imp ( ) ;
45
+ imp . on_increment_clicked( ) ;
46
46
} ) ) ;
47
47
48
48
obj. add ( & label) ;
Original file line number Diff line number Diff line change @@ -18,9 +18,8 @@ impl ExampleApplicationWindow {
18
18
fn init_label ( & self ) {
19
19
// To access fields such as template children, you must get
20
20
// the private struct.
21
- let self_ = imp:: ExampleApplicationWindow :: from_instance ( self ) ;
22
- self_
23
- . subtitle
21
+ let imp = self . imp ( ) ;
22
+ imp. subtitle
24
23
. set_text ( "This is an example window made using composite templates" ) ;
25
24
}
26
25
}
Original file line number Diff line number Diff line change @@ -19,12 +19,12 @@ impl Model {
19
19
}
20
20
21
21
pub fn append ( & self , obj : & RowData ) {
22
- let self_ = imp:: Model :: from_instance ( self ) ;
22
+ let imp = self . imp ( ) ;
23
23
let index = {
24
24
// Borrow the data only once and ensure the borrow guard is dropped
25
25
// before we emit the items_changed signal because the view
26
26
// could call get_item / get_n_item from the signal handler to update its state
27
- let mut data = self_ . 0 . borrow_mut ( ) ;
27
+ let mut data = imp . 0 . borrow_mut ( ) ;
28
28
data. push ( obj. clone ( ) ) ;
29
29
data. len ( ) - 1
30
30
} ;
@@ -33,8 +33,8 @@ impl Model {
33
33
}
34
34
35
35
pub fn remove ( & self , index : u32 ) {
36
- let self_ = imp:: Model :: from_instance ( self ) ;
37
- self_ . 0 . borrow_mut ( ) . remove ( index as usize ) ;
36
+ let imp = self . imp ( ) ;
37
+ imp . 0 . borrow_mut ( ) . remove ( index as usize ) ;
38
38
// Emits a signal that 1 item was removed, 0 added at the position index
39
39
self . items_changed ( index, 1 , 0 ) ;
40
40
}
Original file line number Diff line number Diff line change @@ -10,6 +10,38 @@ glib::wrapper! {
10
10
}
11
11
12
12
impl Geometry {
13
+ #[ allow( clippy:: too_many_arguments) ]
14
+ pub fn new (
15
+ min_width : i32 ,
16
+ min_height : i32 ,
17
+ max_width : i32 ,
18
+ max_height : i32 ,
19
+ base_width : i32 ,
20
+ base_height : i32 ,
21
+ width_inc : i32 ,
22
+ height_inc : i32 ,
23
+ min_aspect : f64 ,
24
+ max_aspect : f64 ,
25
+ win_gravity : Gravity ,
26
+ ) -> Self {
27
+ assert_initialized_main_thread ! ( ) ;
28
+ unsafe {
29
+ Geometry :: unsafe_from ( ffi:: GdkGeometry {
30
+ min_width,
31
+ min_height,
32
+ max_width,
33
+ max_height,
34
+ base_width,
35
+ base_height,
36
+ width_inc,
37
+ height_inc,
38
+ min_aspect,
39
+ max_aspect,
40
+ win_gravity : win_gravity. into_glib ( ) ,
41
+ } )
42
+ }
43
+ }
44
+
13
45
pub fn min_width ( & self ) -> i32 {
14
46
self . inner . min_width
15
47
}
Original file line number Diff line number Diff line change 1
1
// Take a look at the license at the top of the repository in the LICENSE file.
2
2
3
+ #![ cfg_attr( feature = "dox" , feature( doc_cfg) ) ]
3
4
#![ doc = include_str ! ( "../README.md" ) ]
4
5
6
+ pub use ffi;
5
7
pub use gdk;
6
8
7
9
mod wayland_device;
Original file line number Diff line number Diff line change
1
+ #![ cfg_attr( feature = "dox" , feature( doc_cfg) ) ]
2
+
1
3
use gdk:: { GdkAtom , GdkDevicePadFeature } ;
2
4
use glib:: { gpointer, GType } ;
3
5
use libc:: { c_char, c_int, c_uint} ;
Original file line number Diff line number Diff line change @@ -2276,6 +2276,8 @@ manual_traits = ["TextBufferExtManual"]
2276
2276
name = " Gtk.TextIter"
2277
2277
status = " generate"
2278
2278
boxed_inline = true
2279
+ [[object .derive ]]
2280
+ name = " Debug"
2279
2281
[[object .function ]]
2280
2282
name = " get_attributes"
2281
2283
manual = true
@@ -2394,6 +2396,8 @@ generate_builder = true
2394
2396
name = " Gtk.TreeIter"
2395
2397
status = " generate"
2396
2398
boxed_inline = true
2399
+ [[object .derive ]]
2400
+ name = " Debug"
2397
2401
2398
2402
[[object ]]
2399
2403
name = " Gtk.TreeModel"
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ use glib::translate::*;
12
12
use std:: cmp;
13
13
14
14
glib:: wrapper! {
15
+ #[ derive( Debug ) ]
15
16
pub struct TextIter ( BoxedInline <ffi:: GtkTextIter >) ;
16
17
17
18
match fn {
You can’t perform that action at this time.
0 commit comments