mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2024-11-22 09:00:59 +00:00
graphview: code cleanup
Remove dead code Rewrite error message Use simplified anyhow result for xml methods
This commit is contained in:
parent
27eeab7b40
commit
2a7137e6dc
3 changed files with 7 additions and 25 deletions
|
@ -40,7 +40,7 @@ use gtk::{
|
|||
use log::{error, warn};
|
||||
|
||||
use std::cell::RefMut;
|
||||
use std::{cmp::Ordering, collections::HashMap, error};
|
||||
use std::{cmp::Ordering, collections::HashMap};
|
||||
|
||||
static GRAPHVIEW_STYLE: &str = include_str!("graphview.css");
|
||||
|
||||
|
@ -771,7 +771,7 @@ impl GraphView {
|
|||
self.queue_draw();
|
||||
}
|
||||
|
||||
pub fn render_xml(&self, filename: &str) -> anyhow::Result<(), Box<dyn error::Error>> {
|
||||
pub fn render_xml(&self, filename: &str) -> anyhow::Result<()> {
|
||||
let mut file = File::create(filename).unwrap();
|
||||
let mut writer = EmitterConfig::new()
|
||||
.perform_indent(true)
|
||||
|
@ -825,7 +825,7 @@ impl GraphView {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn load_xml(&self, filename: &str) -> anyhow::Result<(), Box<dyn error::Error>> {
|
||||
pub fn load_xml(&self, filename: &str) -> anyhow::Result<()> {
|
||||
let file = File::open(filename).unwrap();
|
||||
let file = BufReader::new(file);
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ impl Node {
|
|||
pub fn new(id: u32, name: &str, node_type: NodeType) -> Self {
|
||||
let res: Self = glib::Object::new(&[]).expect("Failed to create Node");
|
||||
let private = imp::Node::from_instance(&res);
|
||||
private.id.set(id).expect("Node id already set");
|
||||
private.id.set(id).expect("Node id is already set");
|
||||
res.set_name(name);
|
||||
res.add_css_class("node");
|
||||
private
|
||||
|
@ -183,7 +183,6 @@ impl Node {
|
|||
fn set_name(&self, name: &str) {
|
||||
let self_ = imp::Node::from_instance(self);
|
||||
self_.name.set_text(name);
|
||||
println!("{}", name);
|
||||
}
|
||||
|
||||
fn set_description(&self, description: &str) {
|
||||
|
@ -276,7 +275,7 @@ impl Node {
|
|||
|
||||
pub fn add_property(&self, name: String, value: String) {
|
||||
let private = imp::Node::from_instance(self);
|
||||
println!("{} {} updated", name, value);
|
||||
println!("property name={} updated with value={}", name, value);
|
||||
private.properties.borrow_mut().insert(name, value);
|
||||
self.update_description();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
use gtk::{
|
||||
glib::{self, subclass::Signal},
|
||||
glib::{self},
|
||||
prelude::*,
|
||||
subclass::prelude::*,
|
||||
};
|
||||
|
@ -36,8 +36,6 @@ pub enum PortDirection {
|
|||
impl fmt::Display for PortDirection {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{:?}", self)
|
||||
// or, alternatively:
|
||||
// fmt::Debug::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +52,7 @@ impl PortDirection {
|
|||
|
||||
mod imp {
|
||||
use super::*;
|
||||
use once_cell::{sync::Lazy, unsync::OnceCell};
|
||||
use once_cell::unsync::OnceCell;
|
||||
|
||||
/// Graphical representation of a pipewire port.
|
||||
#[derive(Default, Clone)]
|
||||
|
@ -85,21 +83,6 @@ mod imp {
|
|||
label.unparent()
|
||||
}
|
||||
}
|
||||
|
||||
fn signals() -> &'static [Signal] {
|
||||
static SIGNALS: Lazy<Vec<Signal>> = Lazy::new(|| {
|
||||
vec![Signal::builder(
|
||||
"port-toggled",
|
||||
// Provide id of output port and input port to signal handler.
|
||||
&[<u32>::static_type().into(), <u32>::static_type().into()],
|
||||
// signal handler sends back nothing.
|
||||
<()>::static_type().into(),
|
||||
)
|
||||
.build()]
|
||||
});
|
||||
|
||||
SIGNALS.as_ref()
|
||||
}
|
||||
}
|
||||
impl WidgetImpl for Port {}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue