api: updated idnode objects to support new rend() method in prop_t
This allows enumerated (ish) types to now be fully sorted and filtered in the way you'd expect from the UI.
This commit is contained in:
parent
1deda4c52e
commit
e27e5346ee
3 changed files with 82 additions and 13 deletions
|
@ -91,6 +91,22 @@ channel_class_services_get ( void *obj )
|
|||
return l;
|
||||
}
|
||||
|
||||
static char *
|
||||
channel_class_services_rend ( void *obj )
|
||||
{
|
||||
char *str;
|
||||
htsmsg_t *l = htsmsg_create_list();
|
||||
channel_t *ch = obj;
|
||||
channel_service_mapping_t *csm;
|
||||
|
||||
LIST_FOREACH(csm, &ch->ch_services, csm_svc_link)
|
||||
htsmsg_add_str(l, NULL, idnode_get_title(&csm->csm_svc->s_id) ?: "");
|
||||
|
||||
str = htsmsg_list_2_csv(l);
|
||||
htsmsg_destroy(l);
|
||||
return str;
|
||||
}
|
||||
|
||||
static int
|
||||
channel_class_services_set ( void *obj, const void *p )
|
||||
{
|
||||
|
@ -124,6 +140,22 @@ channel_class_tags_get ( void *obj )
|
|||
return m;
|
||||
}
|
||||
|
||||
static char *
|
||||
channel_class_tags_rend ( void *obj )
|
||||
{
|
||||
char *str;
|
||||
htsmsg_t *l = htsmsg_create_list();
|
||||
channel_t *ch = obj;
|
||||
channel_tag_mapping_t *ctm;
|
||||
|
||||
LIST_FOREACH(ctm, &ch->ch_ctms, ctm_channel_link)
|
||||
htsmsg_add_str(l, NULL, ctm->ctm_tag->ct_name);
|
||||
|
||||
str = htsmsg_list_2_csv(l);
|
||||
htsmsg_destroy(l);
|
||||
return str;
|
||||
}
|
||||
|
||||
static int
|
||||
channel_class_tags_set ( void *obj, const void *p )
|
||||
{
|
||||
|
@ -141,8 +173,8 @@ channel_class_tags_enum ( void *obj )
|
|||
htsmsg_add_bool(e, "enum", 1);
|
||||
htsmsg_add_msg(m, "params", e);
|
||||
return m;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
channel_class_icon_notify ( void *obj )
|
||||
{
|
||||
|
@ -212,6 +244,7 @@ const idclass_t channel_class = {
|
|||
.get = channel_class_services_get,
|
||||
.set = channel_class_services_set,
|
||||
.list = channel_class_services_enum,
|
||||
.rend = channel_class_services_rend,
|
||||
},
|
||||
{
|
||||
.type = PT_INT,
|
||||
|
@ -221,6 +254,7 @@ const idclass_t channel_class = {
|
|||
.get = channel_class_tags_get,
|
||||
.set = channel_class_tags_set,
|
||||
.list = channel_class_tags_enum,
|
||||
.rend = channel_class_tags_rend
|
||||
},
|
||||
{}
|
||||
}
|
||||
|
|
|
@ -40,13 +40,21 @@ linuxdvb_satconf_class_network_get(void *o)
|
|||
{
|
||||
static const char *s;
|
||||
linuxdvb_satconf_t *ls = o;
|
||||
if (ls->mi_network)
|
||||
s = idnode_uuid_as_str(&ls->mi_network->mn_id);
|
||||
else
|
||||
s = NULL;
|
||||
s = ls->mi_network ? idnode_uuid_as_str(&ls->mi_network->mn_id) : NULL;
|
||||
return &s;
|
||||
}
|
||||
|
||||
static char *
|
||||
linuxdvb_satconf_class_network_rend ( void *o )
|
||||
{
|
||||
const char *buf;
|
||||
linuxdvb_satconf_t *ls = o;
|
||||
if (ls->mi_network)
|
||||
if ((buf = idnode_get_title(&ls->mi_network->mn_id)))
|
||||
return strdup(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
linuxdvb_satconf_class_network_set(void *o, const void *v)
|
||||
{
|
||||
|
@ -90,13 +98,21 @@ linuxdvb_satconf_class_frontend_get ( void *o )
|
|||
{
|
||||
static const char *s;
|
||||
linuxdvb_satconf_t *ls = o;
|
||||
if (ls->ls_frontend)
|
||||
s = idnode_uuid_as_str(&ls->ls_frontend->ti_id);
|
||||
else
|
||||
s = NULL;
|
||||
s = ls->ls_frontend ? idnode_uuid_as_str(&ls->ls_frontend->ti_id) : NULL;
|
||||
return &s;
|
||||
}
|
||||
|
||||
static char *
|
||||
linuxdvb_satconf_class_frontend_rend ( void *o )
|
||||
{
|
||||
const char *buf;
|
||||
linuxdvb_satconf_t *ls = o;
|
||||
if (ls->ls_frontend)
|
||||
if ((buf = idnode_get_title(&ls->ls_frontend->ti_id)))
|
||||
return strdup(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
linuxdvb_satconf_class_frontend_set ( void *o, const void *v )
|
||||
{
|
||||
|
@ -264,7 +280,8 @@ const idclass_t linuxdvb_satconf_class =
|
|||
.name = "Frontend",
|
||||
.get = linuxdvb_satconf_class_frontend_get,
|
||||
.set = linuxdvb_satconf_class_frontend_set,
|
||||
.list = linuxdvb_satconf_class_frontend_enum
|
||||
.list = linuxdvb_satconf_class_frontend_enum,
|
||||
.rend = linuxdvb_satconf_class_frontend_rend,
|
||||
},
|
||||
{
|
||||
.type = PT_STR,
|
||||
|
@ -272,7 +289,8 @@ const idclass_t linuxdvb_satconf_class =
|
|||
.name = "Network",
|
||||
.get = linuxdvb_satconf_class_network_get,
|
||||
.set = linuxdvb_satconf_class_network_set,
|
||||
.list = linuxdvb_satconf_class_network_enum
|
||||
.list = linuxdvb_satconf_class_network_enum,
|
||||
.rend = linuxdvb_satconf_class_network_rend,
|
||||
},
|
||||
{
|
||||
.type = PT_INT,
|
||||
|
|
|
@ -56,12 +56,28 @@ service_class_channel_get ( void *obj )
|
|||
channel_service_mapping_t *csm;
|
||||
|
||||
htsmsg_t *l = htsmsg_create_list();
|
||||
LIST_FOREACH(csm, &svc->s_channels, csm_chn_link)
|
||||
LIST_FOREACH(csm, &svc->s_channels, csm_svc_link)
|
||||
htsmsg_add_str(l, NULL, idnode_uuid_as_str(&csm->csm_chn->ch_id));
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
static char *
|
||||
service_class_channel_rend ( void *obj )
|
||||
{
|
||||
char *str;
|
||||
service_t *svc = obj;
|
||||
channel_service_mapping_t *csm;
|
||||
|
||||
htsmsg_t *l = htsmsg_create_list();
|
||||
LIST_FOREACH(csm, &svc->s_channels, csm_svc_link)
|
||||
htsmsg_add_str(l, NULL, idnode_get_title(&csm->csm_chn->ch_id));
|
||||
|
||||
str = htsmsg_list_2_csv(l);
|
||||
htsmsg_destroy(l);
|
||||
return str;
|
||||
}
|
||||
|
||||
static int
|
||||
service_class_channel_set
|
||||
( void *obj, const void *p )
|
||||
|
@ -154,6 +170,7 @@ const idclass_t service_class = {
|
|||
.get = service_class_channel_get,
|
||||
.set = service_class_channel_set,
|
||||
.list = service_class_channel_enum,
|
||||
.rend = service_class_channel_rend,
|
||||
.opts = PO_NOSAVE
|
||||
},
|
||||
{}
|
||||
|
|
Loading…
Add table
Reference in a new issue