@@ -37,23 +37,29 @@ layout: wide
37
37
38
38
Prepare your system: [ Requirements] ( http://gtk-rs.org/docs-src/requirements.html )
39
39
40
- Include ` gtk ` in your ` Cargo.toml ` and set the minimal GTK version required by your project:
40
+ Include ` gtk ` and ` gio ` in your ` Cargo.toml ` and set the minimal GTK version required by your project:
41
41
{% assign gtk = site.data.crates | where: "name", "gtk" %}
42
42
43
43
~~~ toml
44
44
[dependencies .gtk ]
45
45
version = " {{ gtk[0].max_version }}"
46
46
features = [" v3_16" ]
47
+
48
+ [dependencies .gio ]
49
+ version = " {{ gio[0].max_version }}"
50
+ features = [" v2_44" ]
47
51
~~~
48
52
49
53
__ The APIs aren't stable yet. Watch the Announcements box above for breaking changes to the crates!__
50
54
51
- Import the ` gtk ` crate and its traits:
55
+ Import the ` gtk ` and ` gio ` crates and their traits:
52
56
53
57
~~~ rust
54
58
extern crate gtk;
59
+ extern crate gio;
55
60
56
61
use gtk :: prelude :: * ;
62
+ use gio :: prelude :: * ;
57
63
~~~
58
64
59
65
Create an application, etc.
@@ -62,11 +68,11 @@ Create an application, etc.
62
68
use gtk :: {Application , ApplicationWindow , Button };
63
69
64
70
fn main () {
65
- let application = Application :: new (" com.github.gtk-rs.examples.basic" , Default :: default ()))
71
+ let application = Application :: new (" com.github.gtk-rs.examples.basic" , Default :: default ())
66
72
. expect (" failed to initialize GTK application" );
67
73
68
74
application . connect_activate (| app | {
69
- let window = ApplicationWindow :: new ();
75
+ let window = ApplicationWindow :: new (app );
70
76
window . set_title (" First GTK+ Program" );
71
77
window . set_default_size (350 , 70 );
72
78
0 commit comments