diff --git a/lib/wp/proxy.c b/lib/wp/proxy.c index 39e50c4045134b013bdaaaa6fe4f9ddb8f953202..475a7b96d6b8df5bdb6528625f43a8c4ca2938c7 100644 --- a/lib/wp/proxy.c +++ b/lib/wp/proxy.c @@ -433,6 +433,7 @@ wp_proxy_class_init (WpProxyClass * klass) G_TYPE_NONE, 1, G_TYPE_STRING); } +/* private */ void wp_proxy_destroy (WpProxy *self) { @@ -445,6 +446,36 @@ wp_proxy_destroy (WpProxy *self) pw_proxy_destroy (priv->pw_proxy); } +/** + * wp_proxy_request_destroy: + * @self: the proxy + * + * Requests the PipeWire server to destroy the object represented by this proxy. + * If the server allows it, the object will be destroyed and the + * WpProxy::pw-proxy-destroyed signal will be emitted. If the server does + * not allow it, nothing will happen. + * + * This is mostly useful for destroying #WpLink and #WpEndpointLink objects. + */ +void +wp_proxy_request_destroy (WpProxy * self) +{ + WpProxyPrivate *priv; + g_autoptr (WpCore) core = NULL; + WpRegistry *reg; + + g_return_if_fail (WP_IS_PROXY (self)); + + priv = wp_proxy_get_instance_private (self); + core = wp_proxy_get_core (self); + + if (priv->pw_proxy && core) { + reg = wp_core_get_registry (core); + pw_registry_destroy (reg->pw_registry, + pw_proxy_get_bound_id (priv->pw_proxy)); + } +} + void wp_proxy_augment (WpProxy * self, WpProxyFeatures ft_wanted, GCancellable * cancellable, diff --git a/lib/wp/proxy.h b/lib/wp/proxy.h index 04498dba6cb5a7448ce1b0c5289a3fcacd7aacad..98b7f8ec3a6f884121faac0ff001791423ae02c2 100644 --- a/lib/wp/proxy.h +++ b/lib/wp/proxy.h @@ -98,6 +98,9 @@ struct _WpProxyClass void (*control_changed) (WpProxy * self, const char * id_name); }; +WP_API +void wp_proxy_request_destroy (WpProxy * self); + /* features API */ WP_API