diff --git a/src/ffmpeg.rs b/src/ffmpeg.rs index dbc8ed8..329b0e7 100644 --- a/src/ffmpeg.rs +++ b/src/ffmpeg.rs @@ -57,13 +57,6 @@ impl From for Codec { } } -pub fn check() -> Result<()> { - std::process::Command::new("ffmpeg").output()?; - std::process::Command::new("ffprobe").output()?; - - Ok(()) -} - pub async fn get_video_meta(path: &Path) -> Result { let output = Command::new("ffprobe") .args([ diff --git a/src/main.rs b/src/main.rs index 3256200..2e7d6f5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ use std::{borrow::Cow, path::PathBuf, time::Duration}; use color_eyre::eyre::{OptionExt, Result, bail}; use gobject::GtkZiplineFolder; -use relm::{Dialog, DialogInput, StandaloneDialog, Toast, ToastInput}; +use relm::{Dialog, DialogInput, Toast, ToastInput}; use relm4::{ Component, ComponentController, Controller, RelmApp, Sender, adw::{self, prelude::*}, @@ -391,6 +391,7 @@ impl AsyncComponent for Tyrolienne { } } +// TODO check for ffmpeg // TODO app icon fn main() -> Result<()> { tracing_subscriber::fmt() @@ -399,10 +400,11 @@ fn main() -> Result<()> { color_eyre::install()?; - match ffmpeg::check().and_then(|_| get_config()) { - Ok(config) => RelmApp::new("net.uku3lig.Tyrolienne").run_async::(config), - Err(e) => RelmApp::new("net.uku3lig.Tyrolienne").run::(e.to_string()), - } + // TODO: show dialog in case these error + let config = get_config()?; + + let app = RelmApp::new("net.uku3lig.Tyrolienne"); + app.run_async::(config); Ok(()) } diff --git a/src/relm.rs b/src/relm.rs index 1cefedf..0b0c578 100644 --- a/src/relm.rs +++ b/src/relm.rs @@ -148,53 +148,3 @@ impl SimpleComponent for Toast { } } } - -pub struct StandaloneDialog; - -impl SimpleComponent for StandaloneDialog { - type Init = String; - type Input = (); - type Output = (); - type Root = adw::ApplicationWindow; - type Widgets = (); - - fn init_root() -> Self::Root { - adw::ApplicationWindow::builder() - .title("Tyrolienne") - .default_width(400) - .default_height(300) - .build() - } - - fn init( - init: Self::Init, - root: Self::Root, - _sender: relm4::ComponentSender, - ) -> relm4::ComponentParts { - let dialog = adw::AlertDialog::builder() - .heading("Could not open Tyrolienne") - .body(init) - .close_response("close") - .build(); - dialog.add_response("close", "Close"); - - dialog.connect_closed(clone!( - #[strong] - root, - move |_| root.close() - )); - - root.connect_show(clone!( - #[strong] - dialog, - #[strong] - root, - move |_| dialog.present(Some(&root)) - )); - - relm4::ComponentParts { - model: StandaloneDialog, - widgets: (), - } - } -}