session-item: add _get_associated_proxy_id method

To ease the use case where we are only interested in the id
and not the proxy object itself
This commit is contained in:
George Kiagiadakis
2020-03-31 19:26:05 +03:00
parent bb78b6bbc7
commit a1f47d0627
2 changed files with 23 additions and 0 deletions

View File

@@ -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); 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) * wp_session_item_configure: (virtual configure)
* @self: the session item * @self: the session item

View File

@@ -117,6 +117,10 @@ WP_API
gpointer wp_session_item_get_associated_proxy (WpSessionItem * self, gpointer wp_session_item_get_associated_proxy (WpSessionItem * self,
GType proxy_type); GType proxy_type);
WP_API
guint32 wp_session_item_get_associated_proxy_id (WpSessionItem * self,
GType proxy_type);
/* configuration */ /* configuration */
WP_API WP_API