Skip to content

Commit

Permalink
Add 0.7 release article
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronErhardt committed Mar 13, 2024
1 parent c55d7e8 commit 4e3db43
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cSpell.words": [
"libadwaita",
"relm"
]
}
4 changes: 4 additions & 0 deletions assets/css/extended/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ div.logo > a::before {
margin-bottom: -0.42em;
margin-right: 0.3em;
}

table > tbody > tr > td {
min-width: 0 !important;
}
118 changes: 118 additions & 0 deletions content/posts/announcing_relm4_v0.7/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
title: "Relm4 is back! Announcing version 0.7 and 0.8"
date: 2024-03-12
# weight: 1
tags: ["relm4"]
author: "Aaron Erhardt"
showToc: true
TocOpen: false
draft: false
hidemeta: false
comments: false
disableShare: false
disableHLJS: false
hideSummary: false
ShowReadingTime: true
ShowBreadCrumbs: true
ShowPostNavLinks: true
editPost:
URL: "https://github.com/Relm4/blog/blob/main/content"
Text: "Suggest Changes" # edit text
appendFilePath: true # to append file path to Edit link
---

I'm happy to announce Relm4 0.7 and 0.8!
It has been some time since I last posted here and I actually even skipped the announcement of Relm4 0.6 due to lack of time.
Fortunately, I found some time this week and am back with not one, but two releases!

Because Relm4 follows the version numbers of the underlying gtk-rs crate, we decided to catch up to their recent 0.8 release and postpone any feature development to version 0.9.
This means that version 0.7 and 0.8 of Relm4 are practically identical except for their dependencies.

Check out the [full changelog](https://github.com/Relm4/Relm4/blob/main/CHANGES.md) for more information.

> ## About Relm4
>
> Relm4 is an idiomatic GUI library inspired by [Elm](https://elm-lang.org/) and based on [gtk4-rs](https://crates.io/crates/gtk4).
>
> We believe that GUI development should be easy, productive and delightful.
> The [gtk4-rs](https://crates.io/crates/gtk4) crate already provides everything you need to write modern, beautiful and cross-platform applications.
> Built on top of this foundation, Relm4 makes developing much more idiomatic, simpler and faster and enables you to become productive in just a few hours.
## Factory changes

Starting with Relm4 0.7, factories and components share the same builder pattern for initialization.
This change should especially benefit beginners as it allows reusing the patterns learned while working with components.
It also makes it easier to create reusable factories because the containing component can decide what happens with output messages of the factory and whether they need to be forwarded.

<table>
<tr>
<th> Component </th> <th> Factory </th>
</tr>
<tr>
<td>

```rust
let component = Header::builder()
.launch(init_data)
.forward(sender, |msg| { ... });
```

</td>
<td>

```rust
let factory = FactoryVecDeque::builder()
.launch(root_widget)
.forward(sender, |msg| { ... });
```
</td>
</tr>
</table>

## More typed abstractions

While the gtk4 crate provides outstanding Rust abstractions overall, sometimes it doesn't fully embrace the potential of the Rust language.
Fortunately, to make your code more idiomatic, Relm4 adds several new typed abstractions on top of the existing ones in this release.
After `TypedListView` was added in version 0.6, members of the community have since extended the abstractions with the new `TypedColumnView` and `TypedGridView` types.
All three types allow you to use `gtk::ListView`, `gtk::ColumnView` and `gtk::TypedGridView` respectively without the otherwise necessary boilerplate code and also add compile-time guarantees regarding type-safety.

## Relm4 icons

Technically, the [relm4-icons crate](https://crates.io/crates/relm4-icons) has been out for quite some time, but it was never properly announced.
With this crate, it becomes incredibly easy to add icons to your Relm4 and gtk-rs applications.
You only need to add the crate, a small config file and call `initialize_icons()` in your setup code.
While the crate ships with over 3000 ready-to-use icons and also allows you to add your own SVG icons,
only the configured icons will actually be bundled with your app to keep the resulting binaries small.

If you're already using Relm4 icons, please be aware that starting with this release, you need to use a config file instead of feature flags.
This is because crates.io made the crate un-publishable when [they added new limits for the amount of feature flags](https://blog.rust-lang.org/2023/10/26/broken-badges-and-23k-keywords.html).
While I don't think it was a nice move to ban new releases of existing crates over night, it eventually led to a new, more flexible solution.
This new solution uses a `icons.toml` configuration file to specify which icons you need in your app.

While this works great, this is still a somewhat hacked together solution because, after disallowing the use of many feature flags, Rust has no proper solution for communicating a lot of configuration options to build scripts.
Hopefully, this gap will be filled with a new mechanism in the future.

## More unification

Besides factories, components also received a small, but quite noticeable change that brings more consistency.
Previously, regular components received a reference to the root widget during initialization, but async components used an owned root widget instead to avoid lifetime problems.
When refactoring a regular component to an async component, this caused complex error messages unless the function signatures were updated to use owned root widgets.
By always using owned root widgets, it now takes even fewer steps to refactor between regular and async components.

## Other improvements

- Use native async traits instead of async-trait in v0.8
- Add `AsyncComponentStream` to supports streams for async components
- Add `Toaster` as an abstraction over `adw::ToastOverlay` for usage in the model of a component
- Implement more traits for recent libadwaita widgets
- Port the book to 0.7 and 0.8
- Lots of other improvements and fixes

## Where to get started

+ ⬆️ **[Migration guide](https://relm4.org/book/stable/0_6_to_0_7.html)**
+ 🏠 **[Website](https://relm4.org)**
+**[Repository](https://github.com/Relm4/Relm4)**
+ 📖 **[Book](https://relm4.org/book/stable)**
+ 📜 **[Rust documentation](https://docs.rs/relm4)**
+ 📨 **[Chat room](https://matrix.to/#/#relm4:matrix.org)**
2 changes: 1 addition & 1 deletion themes/PaperMod
Submodule PaperMod updated 61 files
+1 −1 .github/ISSUE_TEMPLATE/bug_report.md
+1 −1 .github/ISSUE_TEMPLATE/config.yml
+0 −7 .github/ISSUE_TEMPLATE/new-blank-issue.md
+7 −0 .github/ISSUE_TEMPLATE/proposal.md
+0 −17 .github/stale.yml
+7 −10 .github/workflows/gh-pages.yml
+1 −1 LICENSE
+14 −4 README.md
+3 −5 assets/css/common/main.css
+7 −3 assets/css/common/post-entry.css
+22 −18 assets/css/common/post-single.css
+5 −4 assets/css/common/profile-mode.css
+1 −1 assets/css/core/license.css
+2 −0 assets/css/core/reset.css
+2 −2 assets/css/core/theme-vars.css
+6 −0 assets/css/core/zmedia.css
+0 −63 assets/css/hljs/an-old-hope.min.css
+24 −0 assets/css/includes/chroma-mod.css
+86 −0 assets/css/includes/chroma-styles.css
+2 −2 assets/css/includes/scroll-bar.css
+6 −1 assets/js/fastsearch.js
+3 −3 assets/js/fuse.basic.min.js
+0 −44 assets/js/highlight.min.js
+1 −1 assets/js/license.js
+33 −0 i18n/cs.yaml
+33 −0 i18n/el.yaml
+2 −2 i18n/fr.yaml
+9 −3 i18n/it.yaml
+2 −2 i18n/ja.yaml
+33 −0 i18n/no.yaml
+33 −0 i18n/pa.yaml
+2 −2 i18n/pl.yaml
+33 −0 i18n/pnb.yaml
+33 −0 i18n/ro.yaml
+33 −0 i18n/sk.yaml
+33 −0 i18n/sw.yaml
+33 −0 i18n/th.yaml
+9 −1 i18n/vi.yaml
+28 −3 layouts/_default/archives.html
+4 −0 layouts/_default/baseof.html
+14 −5 layouts/_default/list.html
+58 −26 layouts/_default/rss.xml
+1 −1 layouts/_default/search.html
+11 −4 layouts/_default/single.html
+1 −1 layouts/partials/breadcrumbs.html
+9 −6 layouts/partials/cover.html
+1 −1 layouts/partials/edit_post.html
+5 −18 layouts/partials/head.html
+1 −1 layouts/partials/header.html
+1 −1 layouts/partials/home_info.html
+1 −1 layouts/partials/index_profile.html
+3 −1 layouts/partials/post_meta.html
+69 −45 layouts/partials/share_icons.html
+4 −3 layouts/partials/social_icons.html
+145 −5 layouts/partials/svg.html
+47 −0 layouts/partials/templates/_funcs/get-page-images.html
+20 −13 layouts/partials/templates/opengraph.html
+8 −3 layouts/partials/templates/schema_json.html
+24 −19 layouts/partials/templates/twitter_cards.html
+2 −2 layouts/partials/toc.html
+1 −1 theme.toml

0 comments on commit 4e3db43

Please sign in to comment.