proxy: unify common info/params API in the WpProxy base class

This commit is contained in:
George Kiagiadakis
2020-01-22 10:34:56 +02:00
parent 6f2844ac13
commit 5c47f1df2c
31 changed files with 795 additions and 914 deletions

View File

@@ -20,12 +20,6 @@ struct _WpProxyClient
struct spa_hook listener;
};
enum {
PROP_0,
PROP_INFO,
PROP_PROPERTIES,
};
G_DEFINE_TYPE (WpProxyClient, wp_proxy_client, WP_TYPE_PROXY)
static void
@@ -43,23 +37,16 @@ wp_proxy_client_finalize (GObject * object)
G_OBJECT_CLASS (wp_proxy_client_parent_class)->finalize (object);
}
static void
wp_proxy_client_get_property (GObject * object, guint property_id,
GValue * value, GParamSpec * pspec)
static gconstpointer
wp_proxy_client_get_info (WpProxy * self)
{
WpProxyClient *self = WP_PROXY_CLIENT (object);
return WP_PROXY_CLIENT (self)->info;
}
switch (property_id) {
case PROP_INFO:
g_value_set_pointer (value, self->info);
break;
case PROP_PROPERTIES:
g_value_take_boxed (value, wp_proxy_client_get_properties (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
WpProperties *
wp_proxy_client_get_properties (WpProxy * self)
{
return wp_properties_new_wrap_dict (WP_PROXY_CLIENT (self)->info->props);
}
static void
@@ -96,30 +83,11 @@ wp_proxy_client_class_init (WpProxyClientClass * klass)
WpProxyClass *proxy_class = (WpProxyClass *) klass;
object_class->finalize = wp_proxy_client_finalize;
object_class->get_property = wp_proxy_client_get_property;
proxy_class->get_info = wp_proxy_client_get_info;
proxy_class->get_properties = wp_proxy_client_get_properties;
proxy_class->pw_proxy_created = wp_proxy_client_pw_proxy_created;
g_object_class_install_property (object_class, PROP_INFO,
g_param_spec_pointer ("info", "info", "The struct pw_client_info *",
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class, PROP_PROPERTIES,
g_param_spec_boxed ("properties", "properties",
"The pipewire properties of the proxy", WP_TYPE_PROPERTIES,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
const struct pw_client_info *
wp_proxy_client_get_info (WpProxyClient * self)
{
return self->info;
}
WpProperties *
wp_proxy_client_get_properties (WpProxyClient * self)
{
return wp_properties_new_wrap_dict (self->info->props);
}
void