idnode: added new general purpose notification routine
This commit is contained in:
parent
84711b6d8f
commit
7e110fe75d
2 changed files with 24 additions and 14 deletions
37
src/idnode.c
37
src/idnode.c
|
@ -655,6 +655,28 @@ idnode_serialize0(idnode_t *self, int optmask)
|
|||
*/
|
||||
static void
|
||||
idnode_updated(idnode_t *in, int optmask)
|
||||
{
|
||||
idnode_notify("idnodeParamsChanged", in, optmask);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void
|
||||
idnode_notify_title_changed(void *obj)
|
||||
{
|
||||
idnode_t *in = obj;
|
||||
htsmsg_t *m = htsmsg_create_map();
|
||||
htsmsg_add_str(m, "id", idnode_uuid_as_str(in));
|
||||
htsmsg_add_str(m, "text", idnode_get_title(in));
|
||||
notify_by_msg("idnodeNameChanged", m);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify on a given channel
|
||||
*/
|
||||
void
|
||||
idnode_notify(const char *chn, idnode_t *in, int optmask)
|
||||
{
|
||||
const idclass_t *ic = in->in_class;
|
||||
|
||||
|
@ -675,20 +697,7 @@ idnode_updated(idnode_t *in, int optmask)
|
|||
add_params(in, in->in_class, p, optmask);
|
||||
htsmsg_add_msg(m, "params", p);
|
||||
|
||||
notify_by_msg("idnodeParamsChanged", m);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void
|
||||
idnode_notify_title_changed(void *obj)
|
||||
{
|
||||
idnode_t *in = obj;
|
||||
htsmsg_t *m = htsmsg_create_map();
|
||||
htsmsg_add_str(m, "id", idnode_uuid_as_str(in));
|
||||
htsmsg_add_str(m, "text", idnode_get_title(in));
|
||||
notify_by_msg("idnodeNameChanged", m);
|
||||
notify_by_msg(chn, m);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -116,6 +116,7 @@ int idnode_is_instance (idnode_t *in, const idclass_t *idc);
|
|||
void *idnode_find (const char *uuid, const idclass_t *idc);
|
||||
idnode_set_t *idnode_find_all(const idclass_t *idc);
|
||||
|
||||
void idnode_notify(const char *chn, idnode_t *in, int optmask);
|
||||
void idnode_notify_title_changed(void *obj);
|
||||
|
||||
htsmsg_t *idclass_serialize0 (const idclass_t *idc, int optmask);
|
||||
|
|
Loading…
Add table
Reference in a new issue