path: root/apps/gui/list.c
diff options
authorThomas Martitz <>2014-03-14 23:15:16 +0100
committerThomas Martitz <>2014-03-14 23:36:30 +0100
commit470989bd708d9a425dbbf2d83b8fcbd0a8d0f488 (patch)
treef3bef37bc0f8ff7da4beddad9903209ced1bc25a /apps/gui/list.c
parent50f0dd80d660b332a1739e07a630c2cef1b678c6 (diff)
events: Rework event subsystem (add_event, send_event) to be more versatile.
add_event_ex is added that takes an extra user_data pointer. This pointer is passed to the callback (add_event and add_event_ex have slightly different callbacks types). All callbacks also get the event id passed. Events added with add_event_ex must be removed with remove_event_ex because the user_data pointer must match in addition to the callback pointer. On the other add_event is simplified to omit the oneshort parameter which was almost always false (still there with add_event_ex). As a side effect the ata_idle_notify callbacks are changed as well, they do not take a data parameter anymore which was always NULL anyway. This commit also adds some documentation to events.h Change-Id: I13e29a0f88ef908f175b376d83550f9e0231f772
Diffstat (limited to 'apps/gui/list.c')
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index c393340c57..8663abe8a0 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -66,16 +66,17 @@ static bool list_is_dirty(struct gui_synclist *list)
return TIME_BEFORE(list->dirty_tick, last_dirty_tick);
-static void list_force_reinit(void *param)
+static void list_force_reinit(unsigned short id, void *param, void *last_dirty_tick)
+ (void)id;
- last_dirty_tick = current_tick;
+ *(int *)last_dirty_tick = current_tick;
void list_init(void)
last_dirty_tick = current_tick;
- add_event(GUI_EVENT_THEME_CHANGED, false, list_force_reinit);
+ add_event_ex(GUI_EVENT_THEME_CHANGED, false, list_force_reinit, &last_dirty_tick);
static void list_init_viewports(struct gui_synclist *list)
@@ -611,8 +612,9 @@ bool gui_synclist_keyclick_callback(int action, void* data)
static struct gui_synclist *current_lists;
static bool ui_update_event_registered = false;
-static void _lists_uiviewport_update_callback(void *data)
+static void _lists_uiviewport_update_callback(unsigned short id, void *data)
+ (void)id;
if (current_lists)
@@ -801,8 +803,7 @@ int list_do_action_timeout(struct gui_synclist *lists, int timeout)
if (!ui_update_event_registered)
ui_update_event_registered =
- add_event(GUI_EVENT_NEED_UI_UPDATE, false,
- _lists_uiviewport_update_callback);
+ add_event(GUI_EVENT_NEED_UI_UPDATE, _lists_uiviewport_update_callback);
current_lists = lists;