feat(observer): rename arg to clarify correct use...
...`subject` => `group_subject` to clarify meaning and correct use so that it is clear that it is not the same as any of the subjects in the `list[]` argument.
This commit is contained in:
committed by
Gabor Kiss-Vamosi
parent
9b3c365ae5
commit
82034cbaee
@@ -279,18 +279,18 @@ lv_color_t lv_subject_get_previous_color(lv_subject_t * subject)
|
|||||||
return subject->prev_value.color;
|
return subject->prev_value.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_subject_init_group(lv_subject_t * subject, lv_subject_t * list[], uint32_t list_len)
|
void lv_subject_init_group(lv_subject_t * group_subject, lv_subject_t * list[], uint32_t list_len)
|
||||||
{
|
{
|
||||||
subject->type = LV_SUBJECT_TYPE_GROUP;
|
group_subject->type = LV_SUBJECT_TYPE_GROUP;
|
||||||
subject->size = list_len;
|
group_subject->size = list_len;
|
||||||
lv_ll_init(&(subject->subs_ll), sizeof(lv_observer_t));
|
lv_ll_init(&(group_subject->subs_ll), sizeof(lv_observer_t));
|
||||||
subject->value.pointer = list;
|
group_subject->value.pointer = list;
|
||||||
|
|
||||||
/* bind all subjects to this subject */
|
/* Bind all list[] subjects to `group_subject`. */
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for(i = 0; i < list_len; i++) {
|
for(i = 0; i < list_len; i++) {
|
||||||
/*If a subject in the group changes notify the group itself*/
|
/* If a subject in `list[]` changes, notify `group_subject`. */
|
||||||
lv_subject_add_observer(list[i], group_notify_cb, subject);
|
lv_subject_add_observer(list[i], group_notify_cb, group_subject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ lv_color_t lv_subject_get_previous_color(lv_subject_t * subject);
|
|||||||
updated, Observers of `group_subject` will be notified.
|
updated, Observers of `group_subject` will be notified.
|
||||||
* @param list_len number of elements in `list[]`
|
* @param list_len number of elements in `list[]`
|
||||||
*/
|
*/
|
||||||
void lv_subject_init_group(lv_subject_t * subject, lv_subject_t * list[], uint32_t list_len);
|
void lv_subject_init_group(lv_subject_t * group_subject, lv_subject_t * list[], uint32_t list_len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all Observers from a Subject and free allocated memory, and delete
|
* Remove all Observers from a Subject and free allocated memory, and delete
|
||||||
|
|||||||
Reference in New Issue
Block a user