You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although this release happened a few months ago, we finally had time to finish this release blog post!
10
+
11
+
This is a smaller release than usual, bringing some nice quality of life improvements.
12
+
13
+
Enjoy!
10
14
11
15
### gtk-rs-core
12
16
13
-
* Removal of glib channels
14
-
* Removal of re-exported once_cell crate, use `std::cell::OnceCell` / `std::sync::OnceLock`
15
-
* Re-organized traits in glib
16
-
* Dynamic types support
17
+
#### Removal of glib channels
18
+
19
+
In this release the `glib::MainContext::channel()` function was removed, together with the corresponding sender/receiver types. In many cases this API has led to overly complicated code in applications because people tried to develop state machines via callbacks, instead of simply making use of async Rust for that purpose.
20
+
21
+
Instead of using the main context channel, the new way of passing values between other threads and the main thread is by using any of the many async channel implementations. Examples for this are the [async-channel](https://docs.rs/async-channel) crate, the MPSC channels from tokio or async-std, the task/thread join handles of both, the [flume](https://docs.rs/flume) crate, ...
22
+
23
+
For example, the following code:
24
+
25
+
```rust
26
+
let (sender, receiver) =glib::MainContext::channel(glib::Priority::DEFAULT);
#### Removal of re-exported once_cell crate, use `std::cell::OnceCell` / `std::sync::OnceLock`
46
+
47
+
<!-- need to write something -->
48
+
49
+
#### Re-organized traits in glib
50
+
51
+
<!-- need to write something -->
52
+
53
+
#### Dynamic types support
54
+
55
+
Let's say you want to create a plugin to add some features or to customize some application. `object_class_dynamic`, `object_interface_dynamic `, `enum_dynamic ` and `flags_dynamic ` are macro helper attributes to make your types dynamic.
Your plugin code has to implement the `TypePlugin` interface or to extend the `TypeModule` type in order to register or unregister your dynamic types when the module (or plugin) is loaded or unloaded.
By default dynamic types are registered when the system loads your plugin. In some cases, it could be useful to postpone the registration of a dynamic type on the first use. This can be done by setting `lazy_registration = true`:
For more complex cases, see the documentation [glib::object_subclass](https://docs.rs/glib/latest/glib/attr.object_subclass.html), [glib::object_interface](https://docs.rs/glib/latest/glib/attr.object_interface.html), [glib::Enum](https://docs.rs/glib/latest/glib/derive.Enum.html), [glib::flags](https://docs.rs/glib/latest/glib/attr.flags.html), [glib::subclass::type_module::TypeModuleImpl](https://docs.rs/glib/latest/glib/subclass/type_module/trait.TypeModuleImpl.html) and [glib::subclass::type_plugin::TypePluginImpl](https://docs.rs/glib/latest/glib/subclass/type_plugin/trait.TypePluginImpl.html).
*[Move from unmaintained winapi crate to windows-sys](https://github.com/gtk-rs/gtk-rs-core/pull/1226)
217
+
*[Windows-specific API bindings that use Windows types were migrated from the unmaintained `winapi` crate to `window-sys`. This might need changes for users of these APIs and require them to migrate too.](https://github.com/gtk-rs/gtk-rs-core/pull/1226)
*[gio: Use weak reference to ActionMap when adding action entries](https://github.com/gtk-rs/gtk-rs-core/pull/1208)
107
225
*[Add \_full and \_local\_full methods for idle and timeout callbacks that take priority](https://github.com/gtk-rs/gtk-rs-core/pull/1207)
108
226
*[Implement ext trait on IsA<T>, don't generate overridden methods](https://github.com/gtk-rs/gtk-rs-core/pull/1204)
109
-
*[glib: Implement object class methods via a trait instead of directly …](https://github.com/gtk-rs/gtk-rs-core/pull/1203)
110
-
*[Add `spawn_future` and `spawn_future_local` convenience functions](https://github.com/gtk-rs/gtk-rs-core/pull/1201)
227
+
*[glib: Implement object class methods via a trait](https://github.com/gtk-rs/gtk-rs-core/pull/1203)
228
+
*[New `glib::spawn_future()` and `glib::spawn_future_local()` convenience functions that directly spawn a future on the current thread default's main context, without first having to retrieve it](https://github.com/gtk-rs/gtk-rs-core/pull/1201)
111
229
*[glib-macros: Remove unused imports from Properties doc test](https://github.com/gtk-rs/gtk-rs-core/pull/1193)
112
230
*[glib-macros: Mark property getters as #\[must\_use\]](https://github.com/gtk-rs/gtk-rs-core/pull/1192)
113
231
*[fix glyph string analysis methods that don't need &mut](https://github.com/gtk-rs/gtk-rs-core/pull/1188)
0 commit comments