mmenu; fixed .desktop and pnd scans differing apps found; .desktop was missing /usr...
[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
18 #define PND_DOTDESKTOP_LIBPND_ONLY 1 /* convenience flag; caller can do this himself as well */
19 pnd_disco_t *pnd_parse_dotdesktop ( char *ddpath, unsigned int flags ); // sets object_flag PND_DISCO_LIBPND_DD for libpnd-origin
20
21 // emit_dotinfo() will spit out a .desktop 'info entry', similar to the way emit_dotdesktop does its thing
22 // - rather than slide this into emit_dotdesktop(), we wish to allow apps to do this or not by calling this
23 //   function, and also let them specify an alternate path to emit to.. without adding all these
24 //   extra fields to emit_dotdesktop()'s function and breaking apps, or annoying callers down the road
25 unsigned char pnd_emit_dotinfo ( char *targetpath, char *pndrun, pnd_disco_t *p );
26
27 // emit_icon() will attempt to copy the icon from a PXML directory, or from a pnd file if appended,
28 // to the given directory; returns 1 on sucess, otherwise is a fail.
29 unsigned char pnd_emit_icon ( char *targetpath, pnd_disco_t *p );
30 unsigned char *pnd_emit_icon_to_buffer ( pnd_disco_t *p, unsigned int *r_buflen ); // returns length of malloc in r_buflen if !NULL
31
32 // pnd_map_dotdesktop_categories() will attempt to find an appropriate standard .desktop category(s) based
33 // on the provided PXML-style category.
34 //   In essence, the PXML top-level (and alternate) category will be used, but if (for example) the top
35 // level primary cat is no good, then it will descend into the alternates for that to find the mapping. 
36 //   NOTE: PXML has a prime and alt category, with sub-category; the standard only supports a flat list of
37 // categories to show an entry in (though any number of 'alternates.' so the formats are not directly
38 // compatible.
39 //   Pass in the PXML handle, and the target buffer will be filled up
40 //   Returns the number of successful mappings on success, or -1 for error (0 for no matches of course.)
41 // QUESTION: It possible makes sense to just copy over verbatim any categories that are unmapped, as a 'best guess'
42 //   scenario, but it currently is not coded like that.
43 int pnd_map_dotdesktop_categories ( pnd_conf_handle c, char *target_buffer, unsigned short int len, pnd_disco_t *d ); // <---
44 char *pnd_map_dotdesktop_category ( pnd_conf_handle c, char *single_category ); // not likely needed by anyone
45 // this default is only used if the conf file's "default" key cannot be found, and the category cannot be mapped
46 #define PND_DOTDESKTOP_DEFAULT_CATEGORY "Application;Utility;"
47
48 #ifdef __cplusplus
49 } /* "C" */
50 #endif
51
52 #endif