From 5f2819f0b899099f6cad52534041871391474f1e Mon Sep 17 00:00:00 2001 From: Hannes Kuchelmeister Date: Sun, 17 Mar 2024 18:15:16 +0100 Subject: [PATCH] add some more icons --- icons.toml | 2 +- src/factories/container_list.rs | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/icons.toml b/icons.toml index bf80968..a47d1d5 100644 --- a/icons.toml +++ b/icons.toml @@ -3,5 +3,5 @@ app_id = "org.kuchelmeister.ToolboxTuner" # List of icon names you found (shipped with this crate) # Note: the file ending `-symbolic.svg` isn't part of the icon name. -icons = ["issue"] +icons = ["issue", "play", "pause", "terminal"] diff --git a/src/factories/container_list.rs b/src/factories/container_list.rs index 68c30e3..569b59a 100644 --- a/src/factories/container_list.rs +++ b/src/factories/container_list.rs @@ -4,6 +4,7 @@ use relm4::adw::prelude::ActionRowExt; use relm4::adw::prelude::PreferencesRowExt; use relm4::factory::{FactoryComponent, FactorySender}; use relm4::gtk; +use relm4_icons::icon_names; #[derive(Debug)] pub struct Container { @@ -29,12 +30,18 @@ impl FactoryComponent for Container { view! { root = adw::ActionRow { #[watch] - set_title: &self.hash, + set_title: format!{"{}: {}", self.hash, self.value.to_string()}.as_str(), + + #[name(play_button)] + add_prefix = >k::Button { + // TODO: make component with state that either is waiting, play or pause + set_icon_name: icon_names::PLAY, + connect_clicked => ContainerMsg::Start, + }, #[name(add_button)] add_suffix = >k::Button { - #[watch] - set_label: &self.value.to_string(), + set_icon_name: icon_names::TERMINAL, connect_clicked => ContainerMsg::Start, }, }