!DlltQISlgRGacjtFQD:matrix.org

Relm4

220 Members
Build truly native applications with ease!41 Servers

Load older messages


SenderMessageTime
25 Jul 2024
@aaron:matrix.aaron-erhardt.deAaron ErhardtCurrently not, you have to use the builder pattern for components in general.09:51:34
@okhsunrogm:matrix.orgokhsunrogWe 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
@okhsunrogm:matrix.orgokhsunrogmy Combo Box shows serial ports in system and the list of available serial ports could potentially be empty12:52:11
@okhsunrogm:matrix.orgokhsunrog

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
@okhsunrogm:matrix.orgokhsunrog Aaron Erhardt: I can create a PR 12:54:53
@aaron:matrix.aaron-erhardt.deAaron ErhardtSure, that'd be great :)12:59:10
@chfkch:matrix.orgchfkch @[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:matrix.orgchfkchI have to create a nix dev environment if yes, just to add a link 🧐13:11:02
@aaron:matrix.aaron-erhardt.deAaron ErhardtNo, in this case you can skip them. It would be rather unlikely that updating the README breaks the code.13:11:41
@chfkch:matrix.orgchfkchYeah,just wanted to be sure13:11:59
@chfkch:matrix.orgchfkchAlso no Changes.md?13:12:24
@aaron:matrix.aaron-erhardt.deAaron ErhardtYes, the checklist is only meant for code changes (I guess I should mention it in the template).13:13:09
@okhsunrogm:matrix.orgokhsunrog Aaron Erhardt: do I need to update changed.md for fixing panics in get_active_elem? 13:30:16
@okhsunrogm:matrix.orgokhsunrog * Aaron Erhardt: do I need to update changes.md for fixing panics in get_active_elem? 13:30:44
@aaron:matrix.aaron-erhardt.deAaron ErhardtYes, it's good to know in which specific version something was fixed if someone encounters the same problem later13:32:10
@okhsunrogm:matrix.orgokhsunrogdone, created PR13:38:07
@okhsunrogm:matrix.orgokhsunrogimage.png
Download image.png
21:28:29
@okhsunrogm:matrix.orgokhsunroghow do I make dark theme?21:28:38
@aaron:matrix.aaron-erhardt.deAaron ErhardtThe 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
@okhsunrogm:matrix.orgokhsunrogit 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 work12:59:26
@aaron:matrix.aaron-erhardt.deAaron 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
@okhsunrogm:matrix.orgokhsunrog where can I read more about update_with_view? 13:29:15
@aaron:matrix.aaron-erhardt.deAaron Erhardthttps://docs.rs/relm4/latest/relm4/component/trait.Component.html#method.update_with_view14:16:04
@aaron:matrix.aaron-erhardt.deAaron ErhardtAlternatively, you can also add custom logic to the view update: https://relm4.org/book/stable/component_macro/reference.html#manual-code14:16:38
@okhsunrogm:matrix.orgokhsunrogcan async tasks be used as a drop-in replacement for gtk4::glib::timeout_add_local ?14:40:27
@okhsunrogm:matrix.orgokhsunrogI guess they can't because GTK is not thread safe, right? So I have to combine async with timeout_add_local, I guess14:41:15
@aaron:matrix.aaron-erhardt.deAaron 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:matrix.aaron-erhardt.deAaron ErhardtBtw. I won't respond as frequently over the next days because I'm on vacation.15:15:25
@okhsunrogm:matrix.orgokhsunrogOkay. 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
@okhsunrogm:matrix.orgokhsunrog * 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

There are no newer messages yet.


Back to Room ListRoom Version: 6