5 /* code for storing/retrieving/messing with 'categories' (ie: tabs, more or less)
8 // an appreg is a minimenu registered app, that in turn points to the libpnd disco-t entry, but also stores anything
9 // minimenu specific about it.
10 typedef struct _mm_appref_t {
14 struct _mm_appref_t *next;
17 // an actual category reference; points to a list of appref's and supplies a tabname, a filesystem mountpoint, etc.
18 typedef struct _mm_category_t {
19 char *catname; // name of the category
20 char *parent_catname; // if known, parent cat name
21 unsigned int catflags; // flags
23 // current applications
24 mm_appref_t *refs; // apps (from g_active_apps) that are in this category
25 unsigned int refcount; // how many apps in this category
27 // if a directory browser category, additional info is needed
28 char *fspath; // NULL if a pnd-category (not a filesystem category)
29 pnd_box_handle disco; // faux-applications generated from filesystem (so that refs can point to here)
33 // the flags available for the above mm_category_t.catflags
34 #define CFNORMAL 1 // catflag
35 #define CFHIDDEN 2 // catflag: 1, 2, 4,...
36 #define CFSUBCAT 4 // catflag
38 // how many cats can we handle?
41 // what do we call the "All" tab, if present
42 #define CATEGORY_ALL "All"
44 // try to populate as many cats as necessary
45 void category_init ( void ); // set up; call first!
46 unsigned char category_push ( char *catname, char *parentcatname, pnd_disco_t *app, pnd_conf_handle ovrh, char *fspath, unsigned char visiblep ); // catname is not pulled from app, so we can make them up on the fly (ie: "All");
47 void category_dump ( void ); // sort the apprefs
48 void category_freeall ( void );
49 int cat_sort_score ( mm_category_t *cat, mm_appref_t *s1, mm_appref_t *s2 ); // like strcmp, but used to sort apps by title
50 void category_sort ( void ); // for sorting categories
52 // category mapping hack
54 mm_category_t *target; // mapping a category _to_ this other category
55 char *from; // from this category
58 unsigned char category_map_setup ( void ); // set up the mappings
59 mm_category_t *category_map_query ( char *cat );
60 unsigned char category_meta_push ( char *catname, char *parentcatname, pnd_disco_t *app, pnd_conf_handle ovrh, unsigned char visiblep, unsigned char parentp ); // parentp is 0 for child, 1 for parent - main, 2 for parent - alt
63 unsigned char category_fs_restock ( mm_category_t *cat );
66 unsigned char category_contains_app ( char *catname, char *parentcatname, char *unique_id );
68 // advertising to rest of the system
70 extern mm_category_t *g_categories [ MAX_CATS ];
71 extern unsigned char g_categorycount;
72 #define CFALL 0xFF // filter mask
73 #define CFBYNAME 0xFE // filter mask; the name param is used to pick a single category to populate
74 void category_publish ( unsigned int filter_mask, char *param ); // populates g_categories and g_categorycount; pass in CFNORMAL or CFHIDDEN or CFALL or whatever
75 unsigned int category_count ( unsigned int filter_mask );
76 int category_index ( char *catname ); // figure out index in g_categories of named cat