25 Jul 2024 |
Aaron Erhardt | Currently not, you have to use the builder pattern for components in general. | 09:51:34 |
okhsunrog | We could probably improve get_active_elem method of SimpleComboBox. It panics when the Combo Box is empty (variants is an empty vector) | 12:48:14 |
okhsunrog | my Combo Box shows serial ports in system and the list of available serial ports could potentially be empty | 12:52:11 |
okhsunrog | can we modify it to look like this?
pub fn get_active_elem(&self) -> Option<&E> {
self.active_index.and_then(|idx| self.variants.get(idx))
}
| 12:54:40 |
okhsunrog | Aaron Erhardt: I can create a PR | 12:54:53 |
Aaron Erhardt | Sure, that'd be great :) | 12:59:10 |
chfkch | @[Aaron Erhardt] if i want to update the Readme section "projects using relm4" do i have to run test and clippy etc aswell? | 13:10:35 |
chfkch | I have to create a nix dev environment if yes, just to add a link 🧐 | 13:11:02 |
Aaron Erhardt | No, in this case you can skip them. It would be rather unlikely that updating the README breaks the code. | 13:11:41 |
chfkch | Yeah,just wanted to be sure | 13:11:59 |
chfkch | Also no Changes.md? | 13:12:24 |
Aaron Erhardt | Yes, the checklist is only meant for code changes (I guess I should mention it in the template). | 13:13:09 |
okhsunrog | Aaron Erhardt: do I need to update changed.md for fixing panics in get_active_elem? | 13:30:16 |
okhsunrog | * Aaron Erhardt: do I need to update changes.md for fixing panics in get_active_elem? | 13:30:44 |
Aaron Erhardt | Yes, it's good to know in which specific version something was fixed if someone encounters the same problem later | 13:32:10 |
okhsunrog | done, created PR | 13:38:07 |
okhsunrog | ![image.png](https://matrix.org/_matrix/media/r0/thumbnail/matrix.org/yPFQFRTeegfSssEksjSyggqW?height=360&method=scale&width=360) Download image.png | 21:28:29 |
okhsunrog | how do I make dark theme? | 21:28:38 |
Aaron Erhardt | The easiest solution would be using libadwaita. I think GTK on its own supports dark themes by default as well (it just doesn't detect and change it automatically), but I don't know exactly how, so you might have more luck with this question in the GTK or gtk-rs matrix rooms. | 21:45:10 |
26 Jul 2024 |
okhsunrog | it there a way to do something like this https://gitlab.gnome.org/GNOME/gtk/-/blob/main/demos/gtk-demo/textscroll.c in relm4? Can't make auto scrolling of a text view work | 12:59:26 |
Aaron Erhardt | Yes, should be possible. You have to port the code to Rust and might need update_with_view for more control, but otherwise it should work. | 13:19:21 |
okhsunrog | where can I read more about update_with_view ? | 13:29:15 |
Aaron Erhardt | https://docs.rs/relm4/latest/relm4/component/trait.Component.html#method.update_with_view | 14:16:04 |
Aaron Erhardt | Alternatively, you can also add custom logic to the view update: https://relm4.org/book/stable/component_macro/reference.html#manual-code | 14:16:38 |
okhsunrog | can async tasks be used as a drop-in replacement for gtk4::glib::timeout_add_local ? | 14:40:27 |
okhsunrog | I guess they can't because GTK is not thread safe, right? So I have to combine async with timeout_add_local, I guess | 14:41:15 |
Aaron Erhardt | Yes, you can even use tokio futures in Relm4 inside of async components or spawn_local . This is because Relm4 adds compatibility between glib (GTK's runtime) and tokio. You can also see this in the simple_async example: https://github.com/Relm4/Relm4/blob/main/examples/simple_async.rs#L78
| 14:59:33 |
Aaron Erhardt | Btw. I won't respond as frequently over the next days because I'm on vacation. | 15:15:25 |
okhsunrog | Okay. I'll continue reading the gtk-rs and relm4 books with examples then. Hope thing will be more clear to me in a day or two. Thanks for your help! | 15:17:37 |
okhsunrog | * Okay. I'll continue reading the gtk-rs and relm4 books with examples then. Hope things will be more clear to me in a day or two. Thanks for your help! | 15:17:45 |