zoodex/src/ui/components/media_details/series_details.rs
Reinout Meliesie 629f2ba9d0
Implement watched toggle for films in details modal
- Watched status is stored in the local database
- Gave details modals a set size
- Added a for now useless play button to film details modal
2026-01-24 18:25:59 +01:00

47 lines
1.2 KiB
Rust

use gtk4::prelude::{BoxExt, OrientableExt, WidgetExt};
use gtk4::{Justification, Label, Orientation};
use relm4::{ComponentParts, ComponentSender, RelmWidgetExt, SimpleComponent, component};
use crate::views::overview::SeriesOverview;
pub struct SeriesDetails {
series_overview: SeriesOverview,
}
#[component(pub)]
impl SimpleComponent for SeriesDetails {
type Init = SeriesOverview;
type Input = ();
type Output = ();
view! {
gtk4::Box {
set_orientation: Orientation::Vertical,
set_spacing: 40,
set_margin_all: 100,
Label {
set_wrap: true,
// Not the actual limit, used instead to avoid the text width propagating to the
// requested widget width, behaving similarly to hexpand: false.
set_max_width_chars: 1,
// Keeps wrapped text centered.
set_justify: Justification::Center,
set_css_classes: &["title-1"],
set_label: model.series_overview.name.as_str(),
}
}
}
fn init(
series_overview: SeriesOverview,
root: gtk4::Box,
_sender: ComponentSender<SeriesDetails>,
) -> ComponentParts<SeriesDetails> {
let model = SeriesDetails { series_overview };
let widgets = view_output!();
ComponentParts { model, widgets }
}
}