dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Misconception in the "simple list" API

Misconception in the "simple list" API

From: Al Le <>
Date: Thu, 08 Apr 2010 17:40:35 +0200

What I don't like about the simple list API (in apps/gui/list.h) is the
following. Before you show a list you should initialize a data structure
via a call to 'simplelist_info_init', passing the structure to be
initialized as the parameter.

Then, in the simplest and, I think, most frequently used case, you add
the list items via 'simplelist_addline'. Here, there's already a
discrepancy. The first call suggests that you could, for example,
initialize two list structures and then show them one after the other.
But that's not true because the list items are stored in a static array,
hence there can only exist one list at a time.

There are two solutions to this: either make all functions and data
structures for simple lists static, or make them non-static (i.e. place
the list items array into the simplelist struct).

Personally I'd prefer the latter. What do you think?
Received on 2010-04-08

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy