diff --git a/lib/wp/link.c b/lib/wp/link.c index 5ea9e1be3fab1797e4369d82c23d2700ee6fdbd4..157cb155cc985e0318e45d4f52d2f6e9b2fdb288 100644 --- a/lib/wp/link.c +++ b/lib/wp/link.c @@ -146,3 +146,32 @@ wp_link_new_from_factory (WpCore * core, props ? wp_properties_peek_dict (props) : NULL, 0)); return self; } + +/** + * wp_link_get_linked_object_ids: + * @self: the link + * @output_node: (out) (optional): the bound id of the output (source) node + * @output_port: (out) (optional): the bound id of the output (source) port + * @input_node: (out) (optional): the bound id of the input (sink) node + * @input_port: (out) (optional): the bound id of the input (sink) port + * + * Retrieves the ids of the objects that are linked by this link + * + * Note: Using this method requires %WP_PROXY_FEATURE_INFO + */ +void +wp_link_get_linked_object_ids (WpLink * self, + guint32 * output_node, guint32 * output_port, + guint32 * input_node, guint32 * input_port) +{ + g_return_if_fail (WP_IS_LINK (self)); + + if (output_node) + *output_node = self->info->output_node_id; + if (output_port) + *output_port = self->info->output_port_id; + if (input_node) + *input_node = self->info->input_node_id; + if (input_port) + *input_port = self->info->input_port_id; +} diff --git a/lib/wp/link.h b/lib/wp/link.h index f0d5cb3c8ce8764c5a5eb6a8b8388b8d898c9e85..a9b294d09b490b0cf7062c681d47338e40a7a9ba 100644 --- a/lib/wp/link.h +++ b/lib/wp/link.h @@ -26,6 +26,11 @@ WP_API WpLink * wp_link_new_from_factory (WpCore * core, const gchar * factory_name, WpProperties * properties); +WP_API +void wp_link_get_linked_object_ids (WpLink * self, + guint32 * output_node, guint32 * output_port, + guint32 * input_node, guint32 * input_port); + G_END_DECLS #endif