diff --git a/lib/wp/session-item.c b/lib/wp/session-item.c index 10aef8a9d7cfab78407f9daa8f79140c59a825bb..5d5db7bc9ea357b782493ca05d1039b9b179667f 100644 --- a/lib/wp/session-item.c +++ b/lib/wp/session-item.c @@ -498,6 +498,25 @@ wp_session_item_get_associated_proxy (WpSessionItem * self, GType proxy_type) return WP_SESSION_ITEM_GET_CLASS (self)->get_associated_proxy (self, proxy_type); } +/** + * wp_session_item_get_associated_proxy_id: + * @self: the session item + * @proxy_type: a #WpProxy subclass #GType + * + * Returns: the bound id of the associated proxy of the specified @proxy_type, + * or `SPA_ID_INVALID` if there is no association to such a proxy + */ +guint32 +wp_session_item_get_associated_proxy_id (WpSessionItem * self, GType proxy_type) +{ + g_autoptr (WpProxy) proxy = wp_session_item_get_associated_proxy (self, + proxy_type); + if (!proxy) + return SPA_ID_INVALID; + + return wp_proxy_get_bound_id (proxy); +} + /** * wp_session_item_configure: (virtual configure) * @self: the session item diff --git a/lib/wp/session-item.h b/lib/wp/session-item.h index 96cf638c568a689515726ddae3676d190c99a0b7..92efd2cb1ef0ad02c76031fa47ca82f8d15e1201 100644 --- a/lib/wp/session-item.h +++ b/lib/wp/session-item.h @@ -117,6 +117,10 @@ WP_API gpointer wp_session_item_get_associated_proxy (WpSessionItem * self, GType proxy_type); +WP_API +guint32 wp_session_item_get_associated_proxy_id (WpSessionItem * self, + GType proxy_type); + /* configuration */ WP_API