From 5c254175695e8b3ed12f222ef6e619178240dbc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Tue, 25 Jan 2022 11:53:36 +0100 Subject: [PATCH] pipeline: set state to stop when error Do not display a dialog when an error happens, only a log error is sufficient. --- src/gps/pipeline.rs | 13 ++----------- src/ui/message.rs | 1 + 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/gps/pipeline.rs b/src/gps/pipeline.rs index de2ccfc..c0f8ed8 100644 --- a/src/gps/pipeline.rs +++ b/src/gps/pipeline.rs @@ -19,7 +19,6 @@ use crate::graphmanager::{GraphView, Node, NodeType, PortDirection, PropertyExt}; use crate::logger; -use crate::ui::message as GPSMessage; use crate::GPS_INFO; use gst::glib; @@ -157,16 +156,8 @@ impl Pipeline { err.error(), err.debug() ); - GPSMessage::display_error_dialog( - false, - format!( - "Error from {:?}: {} ({:?})", - err.src().map(|s| s.path_string()), - err.error(), - err.debug() - ) - .as_str(), - ); + self.set_state(PipelineState::Stopped) + .expect("Unable to set state to stopped"); } MessageView::Application(msg) => match msg.structure() { // Here we can send ourselves messages from any thread and show them to the user in diff --git a/src/ui/message.rs b/src/ui/message.rs index f9d80ed..539fdff 100644 --- a/src/ui/message.rs +++ b/src/ui/message.rs @@ -61,6 +61,7 @@ pub fn display_message_dialog( dialog.show(); } +#[allow(dead_code)] pub fn display_error_dialog(fatal: bool, message: &str) { display_message_dialog(message, gtk::MessageType::Error, move |app| { if fatal {