94bc2ebac90655d5920d16f52c218dd9f10a9342
[pandora-libraries.git] / include / pnd_desktop.h
1
2 #ifndef h_pnd_desktop_h
3 #define h_pnd_desktop_h
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 #define PND_PNDHUP_KEY "launcher.hupscript"
10 #define PND_PNDHUP_FILENAME "pnd_hup.sh"
11
12 // emit_dotdesktop() will determine a filename and create a FILENAME.desktop file in the targetpath
13 // TODO: Copy the icon into this directory as well, if its source is a .pnd or info is in the dico struct
14 #define PND_DOTDESKTOP_HEADER "[Desktop Entry]"
15 #define PND_DOTDESKTOP_SOURCE "X-Pandora-Source=libpnd"
16 unsigned char pnd_emit_dotdesktop ( char *targetpath, char *pndrun, pnd_disco_t *p );
17 pnd_disco_t *pnd_parse_dotdesktop ( char *ddpath );
18
19 // emit_dotinfo() will spit out a .desktop 'info entry', similar to the way emit_dotdesktop does its thing
20 // - rather than slide this into emit_dotdesktop(), we wish to allow apps to do this or not by calling this
21 //   function, and also let them specify an alternate path to emit to.. without adding all these
22 //   extra fields to emit_dotdesktop()'s function and breaking apps, or annoying callers down the road
23 unsigned char pnd_emit_dotinfo ( char *targetpath, char *pndrun, pnd_disco_t *p );
24
25 // emit_icon() will attempt to copy the icon from a PXML directory, or from a pnd file if appended,
26 // to the given directory; returns 1 on sucess, otherwise is a fail.
27 unsigned char pnd_emit_icon ( char *targetpath, pnd_disco_t *p );
28 unsigned char *pnd_emit_icon_to_buffer ( pnd_disco_t *p, unsigned int *r_buflen ); // returns length of malloc in r_buflen if !NULL
29
30 // pnd_map_dotdesktop_categories() will attempt to find an appropriate standard .desktop category(s) based
31 // on the provided PXML-style category.
32 //   In essence, the PXML top-level (and alternate) category will be used, but if (for example) the top
33 // level primary cat is no good, then it will descend into the alternates for that to find the mapping. 
34 //   NOTE: PXML has a prime and alt category, with sub-category; the standard only supports a flat list of
35 // categories to show an entry in (though any number of 'alternates.' so the formats are not directly
36 // compatible.
37 //   Pass in the PXML handle, and the target buffer will be filled up
38 //   Returns the number of successful mappings on success, or -1 for error (0 for no matches of course.)
39 // QUESTION: It possible makes sense to just copy over verbatim any categories that are unmapped, as a 'best guess'
40 //   scenario, but it currently is not coded like that.
41 int pnd_map_dotdesktop_categories ( pnd_conf_handle c, char *target_buffer, unsigned short int len, pnd_disco_t *d ); // <---
42 char *pnd_map_dotdesktop_category ( pnd_conf_handle c, char *single_category ); // not likely needed by anyone
43 // this default is only used if the conf file's "default" key cannot be found, and the category cannot be mapped
44 #define PND_DOTDESKTOP_DEFAULT_CATEGORY "Application;Utility;"
45
46 #ifdef __cplusplus
47 } /* "C" */
48 #endif
49
50 #endif