mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2024-12-14 03:56:28 +00:00
graphbook: handle link-added signal
This commit is contained in:
parent
75e49271f5
commit
d05afbc73c
1 changed files with 20 additions and 0 deletions
|
@ -548,4 +548,24 @@ pub fn create_graphtab(app: &GPSApp, id: u32, name: Option<&str>) {
|
||||||
None
|
None
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
let app_weak = app.downgrade();
|
||||||
|
gt.graphview().connect_local(
|
||||||
|
"link-added",
|
||||||
|
false,
|
||||||
|
glib::clone!(move |values: &[Value]| {
|
||||||
|
let app = upgrade_weak!(app_weak, None);
|
||||||
|
let link_id = values[2].get::<u32>().expect("link id args[1]");
|
||||||
|
GPS_TRACE!("link added id={}", link_id);
|
||||||
|
let link = current_graphtab(&app).graphview().link(link_id).unwrap();
|
||||||
|
let port_from = app.port(link.node_from, link.port_from);
|
||||||
|
let caps1 = PropertyExt::property(&port_from, "_caps").unwrap();
|
||||||
|
let port_to = app.port(link.node_to, link.port_to);
|
||||||
|
let caps2 = PropertyExt::property(&port_to, "_caps").unwrap();
|
||||||
|
if !GPS::PadInfo::caps_compatible(&caps1, &caps2) {
|
||||||
|
GPS_WARN!("caps are not compatible caps1={} caps2={}", caps1, caps2);
|
||||||
|
current_graphtab(&app).graphview().remove_link(link_id);
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue