Re-apply a couple fixes that got lost somewhere .. memset after malloc in pnd_pxml...
[pandora-libraries.git] / include / pnd_discovery.h
1
2 #ifndef h_pnd_discovery_h
3 #define h_pnd_discovery_h
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 // this code is for doing the application discovery against a given directory and its children (ie: this
10 // code could be called on appliction startup, or as a result of media eject/insert, and so forth.)
11
12 /* disco_search() will walk the given search path (one or more paths, colon separated) in order left to
13  * right; as PXML's are found, basic analysis is performed to verfy validity. A list of valid applications
14  * is returned, the union of all matches in the search path
15  * If no matches are found, NULL is returned (to save you deleting the container)
16  * overridespath may be NULL if you do not wish to search for pxml overrides
17  */
18 pnd_box_handle pnd_disco_search ( char *searchpath, char *overridespath );
19
20 /* pnd_disco_t describes a given entry found by the discovery code; ie: the containers key is the path to
21  * the PXML file (since this is relatively unique), with the fields below detailing the executable path,
22  * application name, unique-id and so on
23  *
24  * NOTE: this struct is dynamicly populated; you are responsible for invoking the destroy() function to
25  * kill its contents, and the pnt_box_destroy() to kill the container at the end
26  *
27  * NOTE: The PXML path (or .pnd file path in bundle files) is used as a key since it is unique. The
28  * application 'unique id' will be unique for a given app, but that app could be in multiple directories
29  * or on multiple SD cards or wifi or whatever, so only the mounted path is truly unique. The key
30  * is only used internally so the consumer can refer to multiple versions of the same app without
31  * confusion.. it is not displayed. So no big deal.
32  */
33
34 // another struct? Have always intended discovery_t to have minimal members.. just enough to lead to an
35 // application (PXML, xecutable, name); if the apps want more details, they can use the pnd_pxml code to
36 // fetch the full PXML and get all the details. But I think we got out of control here :)
37 typedef struct
38 {
39         char *title_en;
40         char *title_de;
41         char *title_it;
42         char *title_fr;
43         char *unique_id;
44         char *standalone;
45         char *icon;
46         char *description_en;
47         char *description_de;
48         char *description_it;
49         char *description_fr;
50         char *previewpic1;
51         char *previewpic2;
52         char *author_name;
53         char *author_website;
54         char *version_major;
55         char *version_minor;
56         char *version_release;
57         char *version_build;
58         char *exec;
59         char *main_category;
60         char *subcategory1;
61         char *subcategory2;
62         char *altcategory;
63         char *altsubcategory1;
64         char *altsubcategory2;
65         char *osversion_major;
66         char *osversion_minor;
67         char *osversion_release;
68         char *osversion_build;
69         char *associationitem1_name;
70         char *associationitem1_filetype;
71         char *associationitem1_parameter;
72         char *associationitem2_name;
73         char *associationitem2_filetype;
74         char *associationitem2_parameter;
75         char *associationitem3_name;
76         char *associationitem3_filetype;
77         char *associationitem3_parameter;
78         char *clockspeed;
79         char *background;
80         char *startdir;
81
82 } pnd_disco_t;
83
84 void pnd_disco_destroy ( pnd_disco_t *p ); // a function name that simply could not be avoided
85
86 // emit_dotdesktop() will determine a filename and create a FILENAME.desktop file in the targetpath
87 // TODO: Copy the icon into this directory as well, if its source is a .pnd or info is in the dico struct
88 unsigned char pnd_emit_dotdesktop ( char *targetpath, pnd_disco_t *p );
89
90 // TODO: A way to release the disco-lists and reclaim RAM :)
91
92 #ifdef __cplusplus
93 } /* "C" */
94 #endif
95
96 #endif