Skip to content
Snippets Groups Projects
Commit 651701a4 authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

endpoint: use the node.name as the endpoint name and add endpoint.description

endpoint.description is now the user-friendly string
we want the endpoint name to be machine-friendly because it's
the identifier that we store in m-session-settings
parent b17dab8c
No related branches found
No related tags found
No related merge requests found
......@@ -143,9 +143,7 @@ si_adapter_configure (WpSessionItem * item, GVariant * args)
if (g_variant_lookup (args, "name", "&s", &tmp_str)) {
strncpy (self->name, tmp_str, sizeof (self->name) - 1);
} else {
tmp_str = wp_properties_get (props, PW_KEY_NODE_DESCRIPTION);
if (G_UNLIKELY (!tmp_str))
tmp_str = wp_properties_get (props, PW_KEY_NODE_NAME);
tmp_str = wp_properties_get (props, PW_KEY_NODE_NAME);
if (G_LIKELY (tmp_str))
strncpy (self->name, tmp_str, sizeof (self->name) - 1);
}
......@@ -400,6 +398,9 @@ si_adapter_get_properties (WpSiEndpoint * item)
wp_properties_setf (result, PW_KEY_NODE_ID, "%d",
wp_proxy_get_bound_id (WP_PROXY (self->node)));
wp_properties_set (result, "endpoint.description",
wp_properties_get (node_props, PW_KEY_NODE_DESCRIPTION));
/* propagate the device icon, if this is a device */
const gchar *icon = wp_properties_get (node_props, PW_KEY_DEVICE_ICON_NAME);
if (icon)
......
......@@ -116,7 +116,7 @@ si_monitor_endpoint_configure (WpSessionItem * item, GVariant * args)
/* set the name */
g_variant_lookup (adapter_config, "name", "&s", &name);
g_snprintf (self->name, sizeof (self->name) - 1, "Monitor of %s", name);
g_snprintf (self->name, sizeof (self->name) - 1, "monitor.%s", name);
wp_session_item_set_flag (item, WP_SI_FLAG_CONFIGURED);
return TRUE;
......@@ -207,8 +207,14 @@ static WpProperties *
si_monitor_endpoint_get_properties (WpSiEndpoint * item)
{
WpSiMonitorEndpoint *self = WP_SI_MONITOR_ENDPOINT (item);
return wp_si_endpoint_get_properties (WP_SI_ENDPOINT (self->adapter));
WpProperties *properties;
g_autofree gchar *description = NULL;
properties = wp_si_endpoint_get_properties (WP_SI_ENDPOINT (self->adapter));
description = g_strdup_printf ("Monitor of %s",
wp_properties_get (properties, "endpoint.description"));
wp_properties_set (properties, "endpoint.description", description);
return properties;
}
static guint
......
......@@ -128,9 +128,7 @@ si_simple_node_endpoint_configure (WpSessionItem * item, GVariant * args)
if (g_variant_lookup (args, "name", "&s", &tmp_str)) {
strncpy (self->name, tmp_str, sizeof (self->name) - 1);
} else {
tmp_str = wp_properties_get (props, PW_KEY_NODE_DESCRIPTION);
if (G_UNLIKELY (!tmp_str))
tmp_str = wp_properties_get (props, PW_KEY_NODE_NAME);
tmp_str = wp_properties_get (props, PW_KEY_NODE_NAME);
if (G_LIKELY (tmp_str))
strncpy (self->name, tmp_str, sizeof (self->name) - 1);
}
......@@ -273,6 +271,9 @@ si_simple_node_endpoint_get_properties (WpSiEndpoint * item)
wp_properties_setf (result, PW_KEY_NODE_ID, "%d",
wp_proxy_get_bound_id (WP_PROXY (self->node)));
wp_properties_set (result, "endpoint.description",
wp_properties_get (node_props, PW_KEY_NODE_DESCRIPTION));
/* propagate the device icon, if this is a device */
const gchar *icon = wp_properties_get (node_props, PW_KEY_DEVICE_ICON_NAME);
if (icon)
......
......@@ -124,9 +124,14 @@ print_endpoint (const GValue *item, gpointer data)
WpEndpoint *ep = g_value_get_object (item);
guint32 id = wp_proxy_get_bound_id (WP_PROXY (ep));
guint32 default_id = GPOINTER_TO_UINT (data);
const gchar *name;
name = wp_proxy_get_property (WP_PROXY (ep), "endpoint.description");
if (!name)
name = wp_endpoint_get_name (ep);
printf (TREE_INDENT_LINE "%c %4u. %-60s",
(default_id == id) ? '*' : ' ', id, wp_endpoint_get_name (ep));
(default_id == id) ? '*' : ' ', id, name);
print_controls (WP_PROXY (ep));
if (cmdline.status.show_streams) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment