Skip to content

Commit 9bd1e6d

Browse files
Update release post
1 parent bf7ec63 commit 9bd1e6d

File tree

1 file changed

+104
-75
lines changed

1 file changed

+104
-75
lines changed

_posts/2019-02-21-new-release.md

Lines changed: 104 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,109 @@
11
---
22
layout: post
33
author: Guillaume Gomez
4-
title: Across the line
4+
title: Across the line!
55
categories: [front, crates]
66
date: 2019-02-21 15:00:00 +0000
77
---
88

9-
* Write intro here *
9+
Hi everyone!
10+
11+
It's time for a new release! Main adds/changes this time are:
12+
13+
* We added the generation of the `Atk` crate.
14+
* We now generate functions taking callback as parameters.
15+
* We improved the channels handling in `GLib`.
16+
* The whole new `GString` type!
17+
* The minimum Rust version supported is now the `1.31`.
18+
* Even more bindings generated.
19+
20+
Let's see those in details.
21+
22+
#### Atk
23+
24+
The Atk crate is about accessibility. We thought it was a miss not having it considering how important accessibility is, now it's fixed. You can see more information directly on the `Atk` repository: https://github.com/gtk-rs/atk
25+
26+
#### Callbacks?
27+
28+
To present this, let's use the `foreach` method of `TreeModel`:
29+
30+
The C version looks like this:
31+
32+
```C
33+
void gtk_tree_model_foreach(
34+
GtkTreeModel *model,
35+
GtkTreeModelForeachFunc func,
36+
gpointer user_data
37+
);
38+
```
39+
40+
Nothing fancy here: it takes the object we're running this function upon, a callback and some user data. Now here's the Rust version:
41+
42+
```rust
43+
fn foreach<P: FnMut(&TreeModel, &TreePath, &TreeIter) -> bool>(
44+
&self,
45+
func: P,
46+
);
47+
```
48+
49+
No more user data since closures can capture their environment, just the object and the callback (aka closure). Makes things a bit simpler and nicer to use.
50+
51+
#### GLib channels
52+
53+
Instead of rewriting something fully in here, I'll just show you what it looks like and recommend you to go read the excellent Sebastian's blog post about it: https://coaxion.net/blog/2019/02/mpsc-channel-api-for-painless-usage-of-threads-with-gtk-in-rust/
54+
55+
```rust
56+
enum Message {
57+
UpdateLabel(String),
58+
}
59+
60+
[...]
61+
let label = gtk::Label::new("not finished");
62+
[...]
63+
// Create a new sender/receiver pair with default priority
64+
let (sender, receiver) = glib::MainContext::channel(glib::PRIORITY_DEFAULT);
65+
66+
// Spawn the thread and move the sender in there
67+
thread::spawn(move || {
68+
thread::sleep(time::Duration::from_secs(10));
69+
70+
// Sending fails if the receiver is closed
71+
let _ = sender.send(Message::UpdateLabel(String::from("finished")));
72+
});
73+
74+
// Attach the receiver to the default main context (None)
75+
// and on every message update the label accordingly.
76+
let label_clone = label.clone();
77+
receiver.attach(None, move |msg| {
78+
match msg {
79+
Message::UpdateLabel(text) => label_clone.set_text(text.as_str()),
80+
}
81+
82+
// Returning false here would close the receiver
83+
// and have senders fail
84+
glib::Continue(true)
85+
});
86+
```
87+
88+
#### `GString` type?
89+
90+
This type has been created in order to prevent some useless copies to improve performances. For example, if you want to get a button label, you don't ownership over it, you just "get" it. Before the `GString` type, we'd clone the returned string and gave it back to the user. Now, we just hold a temporary reference over it, no more copy!
91+
92+
This is part of our performance focus. More to come in the next release!
93+
94+
#### Minimum Rust version supported
95+
96+
We moved it to `1.31.0` mainly because imports handling is much easier starting this version.
97+
98+
#### Even more bindings generated
99+
100+
Just like usual, with the improvements of our gir crate, we are able to generate more and more parts of all the GNOME libraries we wrote bindings for.
101+
102+
#### Conclusion
103+
104+
That's it for this release! Don't forget to take a look at our brand new [F.A.Q. section](https://gtk-rs.org/docs-src/faq).
105+
106+
And again: thanks **a lot** to all of our contributors! This project lives thanks to their awesome work!
10107

11108
### Changes
12109

@@ -17,19 +114,9 @@ For the interested ones, here is the list of the (major) changes:
17114
* [Install libmount-dev](https://github.com/gtk-rs/sys/pull/131)
18115
* [Update versions in Travis/AppVeyor configuration](https://github.com/gtk-rs/sys/pull/130)
19116
* [Update to GNOME 3.14 versions](https://github.com/gtk-rs/sys/pull/129)
20-
* [WIP: Regen](https://github.com/gtk-rs/sys/pull/127)
21-
* [Regen](https://github.com/gtk-rs/sys/pull/125)
22-
* [Regenerate without special generation of enums with a single member](https://github.com/gtk-rs/sys/pull/122)
23-
* [Regenerate sys crates with new gir and gir-files](https://github.com/gtk-rs/sys/pull/120)
24117
* [Include missing headers for ABI checks.](https://github.com/gtk-rs/sys/pull/90)
25-
* [WIP: Fix name for Cairo.FontType](https://github.com/gtk-rs/sys/pull/117)
26-
* [1 28](https://github.com/gtk-rs/sys/pull/115)
27-
* [Regen for fixing tests errors](https://github.com/gtk-rs/sys/pull/114)
28118
* [Fix generating array of pointers](https://github.com/gtk-rs/sys/pull/113)
29-
* [Regen with GtkResponseType](https://github.com/gtk-rs/sys/pull/112)
30119
* [Fix GtkIconSize usage](https://github.com/gtk-rs/sys/pull/111)
31-
* [Regen check](https://github.com/gtk-rs/sys/pull/107)
32-
* [Regen](https://github.com/gtk-rs/sys/pull/106)
33120

34121
[glib](https://github.com/gtk-rs/glib):
35122

@@ -46,9 +133,7 @@ For the interested ones, here is the list of the (major) changes:
46133
* [Remove leftover testing usage of features for glib/gobject-sys](https://github.com/gtk-rs/glib/pull/443)
47134
* [Update to GNOME 3.14 versions](https://github.com/gtk-rs/glib/pull/442)
48135
* [Add ObjectType trait to prelude](https://github.com/gtk-rs/glib/pull/441)
49-
* [Regen](https://github.com/gtk-rs/glib/pull/437)
50136
* [Add support for defining new interfaces and other minor things](https://github.com/gtk-rs/glib/pull/438)
51-
* [Regen](https://github.com/gtk-rs/glib/pull/429)
52137
* [Only box data passed to Bytes::from_owned() once](https://github.com/gtk-rs/glib/pull/434)
53138
* [Update for signals using the concrete closure type instead of double-…](https://github.com/gtk-rs/glib/pull/433)
54139
* [Add new Object::connect_unsafe(), Object::connect_notify_unsafe() and…](https://github.com/gtk-rs/glib/pull/431)
@@ -57,7 +142,6 @@ For the interested ones, here is the list of the (major) changes:
57142
* [generate from_glib_borrow implementation for const pointers](https://github.com/gtk-rs/glib/pull/428)
58143
* [Replace deprecated tempdir crate](https://github.com/gtk-rs/glib/pull/427)
59144
* [Implement DerefMut for class structs too](https://github.com/gtk-rs/glib/pull/426)
60-
* [Regen](https://github.com/gtk-rs/glib/pull/424)
61145
* [Clean up glib_wrapper! macro and IsA<_>, Wrapper traits and their impls](https://github.com/gtk-rs/glib/pull/421)
62146
* [GString: Avoid copy for From<GString> for String impl](https://github.com/gtk-rs/glib/pull/423)
63147
* [BoolError: allow owning the message](https://github.com/gtk-rs/glib/pull/419)
@@ -68,9 +152,9 @@ For the interested ones, here is the list of the (major) changes:
68152
* [Fixes compilation on aarch64](https://github.com/gtk-rs/glib/pull/413)
69153
* [Don't duplicate property name in subclass::Property type](https://github.com/gtk-rs/glib/pull/412)
70154
* [gstring: Specify a lifetime for the From<str> impl](https://github.com/gtk-rs/glib/pull/411)
71-
* [lib: Introduce GString](https://github.com/gtk-rs/glib/pull/389)
72-
* [variant: Implement Value traits manually](https://github.com/gtk-rs/glib/pull/410)
73-
* [fix: return correct type for Variant::get_type()](https://github.com/gtk-rs/glib/pull/409)
155+
* [Introduce GString](https://github.com/gtk-rs/glib/pull/389)
156+
* [Implement Value traits manually](https://github.com/gtk-rs/glib/pull/410)
157+
* [return correct type for Variant::get_type()](https://github.com/gtk-rs/glib/pull/409)
74158
* [Add signal::connect_raw() working on raw c_char pointers for the sign…](https://github.com/gtk-rs/glib/pull/406)
75159
* [Add subclassing test for registering signals, action signals, emittin…](https://github.com/gtk-rs/glib/pull/404)
76160
* [Add function to get the implementation from an instance](https://github.com/gtk-rs/glib/pull/403)
@@ -85,7 +169,6 @@ For the interested ones, here is the list of the (major) changes:
85169
* [Run tests on travis with the subclassing feature](https://github.com/gtk-rs/glib/pull/394)
86170
* [Migrate subclassing infrastructure to glib-rs](https://github.com/gtk-rs/glib/pull/392)
87171
* [Fix regen_check](https://github.com/gtk-rs/glib/pull/391)
88-
* [Regen](https://github.com/gtk-rs/glib/pull/390)
89172
* [Force 1.28 check](https://github.com/gtk-rs/glib/pull/387)
90173
* [Add bindings for GOptionArg and GOptionFlags](https://github.com/gtk-rs/glib/pull/385)
91174
* [Use ptr::add(i) instead of ptr::offset(i as isize)](https://github.com/gtk-rs/glib/pull/384)
@@ -115,20 +198,14 @@ For the interested ones, here is the list of the (major) changes:
115198
* [Add get_mime_data(), set_mime_data() and supports_mime_type() to cario surface](https://github.com/gtk-rs/cairo/pull/220)
116199
* [Add cairo_font_type_t](https://github.com/gtk-rs/cairo/pull/219)
117200
* [Enum rework](https://github.com/gtk-rs/cairo/pull/217)
118-
* [ add get/set_document_unit() to svg surface ](https://github.com/gtk-rs/cairo/pull/215)
201+
* [add get/set_document_unit() to svg surface ](https://github.com/gtk-rs/cairo/pull/215)
119202
* [Add check for 1.28](https://github.com/gtk-rs/cairo/pull/213)
120203
* [Better support for PDF, SVG and PostScript.](https://github.com/gtk-rs/cairo/pull/165)
121204
* [Remove python unlinking in travis config](https://github.com/gtk-rs/cairo/pull/211)
122205

123206
[sourceview](https://github.com/gtk-rs/sourceview):
124207

125-
* [Regen](https://github.com/gtk-rs/sourceview/pull/79)
126-
* [Regen](https://github.com/gtk-rs/sourceview/pull/78)
127-
* [Regen with sys and fix futures](https://github.com/gtk-rs/sourceview/pull/77)
128-
* [Regen](https://github.com/gtk-rs/sourceview/pull/76)
129-
* [Regen](https://github.com/gtk-rs/sourceview/pull/75)
130208
* [Add check for 1.28](https://github.com/gtk-rs/sourceview/pull/74)
131-
* [Regen](https://github.com/gtk-rs/sourceview/pull/73)
132209
* [Remove connect_xxx_notify for ConstructOnly properties](https://github.com/gtk-rs/sourceview/pull/72)
133210
* [Improve cargo file a bit](https://github.com/gtk-rs/sourceview/pull/71)
134211
* [Fragile](https://github.com/gtk-rs/sourceview/pull/67)
@@ -139,12 +216,6 @@ For the interested ones, here is the list of the (major) changes:
139216
* [Bring Travis and AppVeyor configurations in sync with the GLib one](https://github.com/gtk-rs/atk/pull/18)
140217
* [Update to GNOME 3.14 versions](https://github.com/gtk-rs/atk/pull/17)
141218
* [Update rustc version](https://github.com/gtk-rs/atk/pull/16)
142-
* [Final regen](https://github.com/gtk-rs/atk/pull/15)
143-
* [WIP: Regen](https://github.com/gtk-rs/atk/pull/14)
144-
* [Regen](https://github.com/gtk-rs/atk/pull/13)
145-
* [Regen](https://github.com/gtk-rs/atk/pull/12)
146-
* [Regen for GString support](https://github.com/gtk-rs/atk/pull/10)
147-
* [Regen](https://github.com/gtk-rs/atk/pull/9)
148219
* [improve travis checkup a bit](https://github.com/gtk-rs/atk/pull/8)
149220
* [Fix for 1.28](https://github.com/gtk-rs/atk/pull/7)
150221
* [Split into crate branch](https://github.com/gtk-rs/atk/pull/5)
@@ -159,20 +230,13 @@ For the interested ones, here is the list of the (major) changes:
159230
* [Check if any LGPL docs sneaked in](https://github.com/gtk-rs/gio/pull/193)
160231
* [Bring Travis and AppVeyor configurations in sync with the GLib one](https://github.com/gtk-rs/gio/pull/192)
161232
* [Update to GNOME 3.14 versions](https://github.com/gtk-rs/gio/pull/191)
162-
* [Regen](https://github.com/gtk-rs/gio/pull/190)
163-
* [Regen](https://github.com/gtk-rs/gio/pull/189)
164233
* [Define manual traits](https://github.com/gtk-rs/gio/pull/184)
165234
* [Enable InetAddress{Mask}::equal() and to_string()](https://github.com/gtk-rs/gio/pull/188)
166-
* [Regen](https://github.com/gtk-rs/gio/pull/187)
167235
* [Don't box callbacks and other generic parameters twice in async funct…](https://github.com/gtk-rs/gio/pull/186)
168-
* [Regen](https://github.com/gtk-rs/gio/pull/182)
169-
* [Regen](https://github.com/gtk-rs/gio/pull/180)
170-
* [Regen](https://github.com/gtk-rs/gio/pull/179)
171236
* [Gstring support](https://github.com/gtk-rs/gio/pull/177)
172237
* [Fix socket.rs build with --features dox](https://github.com/gtk-rs/gio/pull/178)
173238
* [Mark functions to create a socket from raw fd/socket as unsafe](https://github.com/gtk-rs/gio/pull/175)
174239
* [Add impls for new std::io::{Read,Write} structs](https://github.com/gtk-rs/gio/pull/172)
175-
* [Regen](https://github.com/gtk-rs/gio/pull/171)
176240
* [Add check for 1.28](https://github.com/gtk-rs/gio/pull/170)
177241
* [Add std::io::{Read,Write} wrappers](https://github.com/gtk-rs/gio/pull/162)
178242
* [Regen](https://github.com/gtk-rs/gio/pull/168)
@@ -185,12 +249,7 @@ For the interested ones, here is the list of the (major) changes:
185249
* [Install libmount-dev](https://github.com/gtk-rs/pango/pull/138)
186250
* [Bring Travis and AppVeyor configurations in sync with the GLib one](https://github.com/gtk-rs/pango/pull/137)
187251
* [Update to GNOME 3.14 versions](https://github.com/gtk-rs/pango/pull/135)
188-
* [Final regen](https://github.com/gtk-rs/pango/pull/134)
189-
* [WIP: Regen](https://github.com/gtk-rs/pango/pull/133)
190-
* [Regen](https://github.com/gtk-rs/pango/pull/132)
191-
* [Regen](https://github.com/gtk-rs/pango/pull/131)
192252
* [Gstring support](https://github.com/gtk-rs/pango/pull/130)
193-
* [Regen](https://github.com/gtk-rs/pango/pull/129)
194253
* [Add check for 1.28](https://github.com/gtk-rs/pango/pull/128)
195254
* [Remove python unlinking in travis config](https://github.com/gtk-rs/pango/pull/127)
196255

@@ -199,20 +258,12 @@ For the interested ones, here is the list of the (major) changes:
199258
* [Install libmount-dev](https://github.com/gtk-rs/gdk-pixbuf/pull/111)
200259
* [Run regen check when building for 3.14](https://github.com/gtk-rs/gdk-pixbuf/pull/110)
201260
* [Bring Travis and AppVeyor configurations in sync with the GLib one](https://github.com/gtk-rs/gdk-pixbuf/pull/109)
202-
* [Fix-up gir/gir-files submodules](https://github.com/gtk-rs/gdk-pixbuf/pull/108)
203261
* [Update to GNOME 3.14 versions](https://github.com/gtk-rs/gdk-pixbuf/pull/107)
204-
* [Final regen](https://github.com/gtk-rs/gdk-pixbuf/pull/106)
205-
* [WIP: Regen](https://github.com/gtk-rs/gdk-pixbuf/pull/105)
206-
* [Regen](https://github.com/gtk-rs/gdk-pixbuf/pull/104)
207262
* [Fix CI](https://github.com/gtk-rs/gdk-pixbuf/pull/103)
208-
* [Regen](https://github.com/gtk-rs/gdk-pixbuf/pull/102)
209263
* [Don't box closures in async functions twice](https://github.com/gtk-rs/gdk-pixbuf/pull/101)
210-
* [Regen](https://github.com/gtk-rs/gdk-pixbuf/pull/100)
211-
* [Regen](https://github.com/gtk-rs/gdk-pixbuf/pull/99)
212264
* [GdkPixbuf::new return Option](https://github.com/gtk-rs/gdk-pixbuf/pull/97)
213265
* [Change PixBuf::from_vec() to PixBuf::from_mut_slice() and allow any A…](https://github.com/gtk-rs/gdk-pixbuf/pull/98)
214266
* [GString support](https://github.com/gtk-rs/gdk-pixbuf/pull/95)
215-
* [Regen](https://github.com/gtk-rs/gdk-pixbuf/pull/94)
216267
* [Add check for 1.28](https://github.com/gtk-rs/gdk-pixbuf/pull/93)
217268
* [Remove python unlinking in travis config](https://github.com/gtk-rs/gdk-pixbuf/pull/92)
218269
* [Remove wrong connect_xxx_notify](https://github.com/gtk-rs/gdk-pixbuf/pull/91)
@@ -225,21 +276,13 @@ For the interested ones, here is the list of the (major) changes:
225276
* [Remove useless gio feature dependencies from Cargo.toml](https://github.com/gtk-rs/gdk/pull/275)
226277
* [Update to GNOME 3.14 versions](https://github.com/gtk-rs/gdk/pull/274)
227278
* [Update rust version](https://github.com/gtk-rs/gdk/pull/273)
228-
* [Regen](https://github.com/gtk-rs/gdk/pull/272)
229-
* [WIP: Regen](https://github.com/gtk-rs/gdk/pull/271)
230-
* [Regen](https://github.com/gtk-rs/gdk/pull/270)
231279
* [Define manual traits](https://github.com/gtk-rs/gdk/pull/265)
232-
* [Regen](https://github.com/gtk-rs/gdk/pull/267)
233280
* [Don't box closures twice](https://github.com/gtk-rs/gdk/pull/266)
234-
* [Regen](https://github.com/gtk-rs/gdk/pull/264)
235281
* [Replace atom borrow](https://github.com/gtk-rs/gdk/pull/263)
236-
* [Regen](https://github.com/gtk-rs/gdk/pull/262)
237282
* [Add missing FromGlibBorrow implementation](https://github.com/gtk-rs/gdk/pull/261)
238-
* [Regen](https://github.com/gtk-rs/gdk/pull/260)
239283
* [Support const array of gdk::Atom](https://github.com/gtk-rs/gdk/pull/259)
240284
* [GString support](https://github.com/gtk-rs/gdk/pull/257)
241285
* [Fix missing cairo conversion](https://github.com/gtk-rs/gdk/pull/255)
242-
* [Regen](https://github.com/gtk-rs/gdk/pull/254)
243286
* [Add check for 1.28](https://github.com/gtk-rs/gdk/pull/253)
244287
* [FrameTimings: use an `Option` when returning refresh_interval](https://github.com/gtk-rs/gdk/pull/252)
245288
* [FrameTimings: use an `Option` when returning presentation time](https://github.com/gtk-rs/gdk/pull/251)
@@ -256,29 +299,21 @@ For the interested ones, here is the list of the (major) changes:
256299
* [Acquire the default MainContext when initializing GTK](https://github.com/gtk-rs/gtk/pull/780)
257300
* [Update to GNOME 3.14 versions](https://github.com/gtk-rs/gtk/pull/778)
258301
* [Tree model sort](https://github.com/gtk-rs/gtk/pull/777)
259-
* [Final regen](https://github.com/gtk-rs/gtk/pull/775)
260-
* [WIP: Regen](https://github.com/gtk-rs/gtk/pull/774)
261302
* [Define manual traits](https://github.com/gtk-rs/gtk/pull/766)
262303
* [Support non-GNU versions of make](https://github.com/gtk-rs/gtk/pull/771)
263304
* [Remove ListBoxExtManual and autogenerate all remaining functions from it](https://github.com/gtk-rs/gtk/pull/770)
264305
* [Don't box signal callbacks twice](https://github.com/gtk-rs/gtk/pull/767)
265306
* [Fix CI](https://github.com/gtk-rs/gtk/pull/769)
266-
* [Regen](https://github.com/gtk-rs/gtk/pull/760)
267307
* [use &self for SelectionData::set(), fix #747](https://github.com/gtk-rs/gtk/pull/748)
268308
* [Rename SelectionData get_data_with_length method to get_data](https://github.com/gtk-rs/gtk/pull/762)
269-
* [Regen](https://github.com/gtk-rs/gtk/pull/759)
270309
* [Add pango-sys](https://github.com/gtk-rs/gtk/pull/758)
271-
* [Regen with fix futures](https://github.com/gtk-rs/gtk/pull/757)
272-
* [Regen](https://github.com/gtk-rs/gtk/pull/756)
273310
* [GString support](https://github.com/gtk-rs/gtk/pull/745)
274311
* [Ignore some more problematic functions](https://github.com/gtk-rs/gtk/pull/752)
275312
* [Update BoolError constructions](https://github.com/gtk-rs/gtk/pull/751)
276313
* [Generate ComboBox::set_active by hand](https://github.com/gtk-rs/gtk/pull/750)
277-
* [Regen](https://github.com/gtk-rs/gtk/pull/742)
278314
* [Add check for 1.28](https://github.com/gtk-rs/gtk/pull/741)
279315
* [Rename socket trait](https://github.com/gtk-rs/gtk/pull/739)
280-
* [Atk](https://github.com/gtk-rs/gtk/pull/740)
281-
* [Regen](https://github.com/gtk-rs/gtk/pull/735)
316+
* [Add Atk](https://github.com/gtk-rs/gtk/pull/740)
282317
* [Into](https://github.com/gtk-rs/gtk/pull/734)
283318
* [Update doc example](https://github.com/gtk-rs/gtk/pull/731)
284319
* [Fix response type](https://github.com/gtk-rs/gtk/pull/728)
@@ -299,13 +334,7 @@ For the interested ones, here is the list of the (major) changes:
299334
* [Bring Travis and AppVeyor configurations in sync with the GLib one](https://github.com/gtk-rs/pangocairo/pull/39)
300335
* [Update to GNOME 3.14 versions](https://github.com/gtk-rs/pangocairo/pull/38)
301336
* [Update rust version](https://github.com/gtk-rs/pangocairo/pull/37)
302-
* [Final regen](https://github.com/gtk-rs/pangocairo/pull/36)
303-
* [WIP: Regen](https://github.com/gtk-rs/pangocairo/pull/35)
304-
* [Regen](https://github.com/gtk-rs/pangocairo/pull/34)
305-
* [Regen](https://github.com/gtk-rs/pangocairo/pull/33)
306337
* [Fix usage of Cairo.FontType](https://github.com/gtk-rs/pangocairo/pull/32)
307-
* [Regen](https://github.com/gtk-rs/pangocairo/pull/31)
308-
* [Regen](https://github.com/gtk-rs/pangocairo/pull/30)
309338
* [Add check for 1.28](https://github.com/gtk-rs/pangocairo/pull/29)
310339
* [Remove python unlinking in travis config](https://github.com/gtk-rs/pangocairo/pull/28)
311340

0 commit comments

Comments
 (0)