add /sbin/ to each losetup call as it seems to be missing from root PATH when sudo...
[pandora-libraries.git] / include / pnd_apps.h
index 51939f9..3ad4fc9 100644 (file)
@@ -6,10 +6,15 @@
 extern "C" {
 #endif
 
+#include "pnd_container.h"
+#include "pnd_discovery.h"
+
 // default application searchpath (and key to look it up in config)
 #define PND_APPS_SEARCHPATH "/media/*/pandora/apps:/usr/pandora/apps"
 #define PND_APPS_KEY "autodiscovery.searchpath"
 
+#define PND_APPS_APPDATA_PREFIX "/pandora/appdata" /* /media/DEVNAME + PREFIX + unique-id */
+
 // default notify searchpath (and key to look it up in config)
 #define PND_APPS_NOTIFYPATH "/media:/media/*/pandora/apps:/usr/pandora/apps"
 #define PND_APPS_NOTIFY_KEY "autodiscovery.notifypath"
@@ -25,10 +30,17 @@ extern "C" {
 #define PND_MOUNT_PATH "/mnt/pnd/" /* all mounted PND images should be here.. /mnt/apps/UNIQUE-ID/... */
 
 // .desktop support
-#define PND_DOTDESKTOP_KEY "dotfiles.dotdesktoppath"
-#define PND_DOTDESKTOPICONS_KEY "dotfiles.iconpath"
-#define PND_DOTDESKTOP_DEFAULT "~/.applications"
-#define PND_DOTDESKTOPICONS_DEFAULT "~/.applications"
+#define PND_DESKTOP_DOTDESKTOP_PATH_KEY "desktop.dotdesktoppath"
+#define PND_DESKTOP_ICONS_PATH_KEY "desktop.iconpath"
+#define PND_DESKTOP_SEARCH_KEY "desktop.searchpath"
+
+#define PND_MENU_DOTDESKTOP_PATH_KEY "menu.dotdesktoppath"
+#define PND_MENU_ICONS_PATH_KEY "menu.iconpath"
+#define PND_MENU_SEARCH_KEY "menu.searchpath"
+
+#define PND_DESKTOP_DOTDESKTOP_PATH_DEFAULT "~/.applications"
+#define PND_DESKTOP_ICONS_PATH_DEFAULT "~/.applications"
+#define PND_DESKTOP_SEARCH_PATH_DEFAULT "/media/*/pandora/desktop:/usr/pandora/apps"
 
 // apps
 #define PND_DEFAULT_WORKDIR "./"
@@ -51,11 +63,29 @@ extern "C" {
 #define PND_EXEC_OPTION_BLOCK      1 /* wait till children complete; note, children might fork on their own.. */
 #define PND_EXEC_OPTION_NOUNION    2 /* request pnd_run not use a union, just do the mount/run */
 #define PND_EXEC_OPTION_NOX11      4 /* request pnd_run to kill x11 and restart it after */
-#define PND_EXEC_OPTION_FUTURE2    8
+#define PND_EXEC_OPTION_NORUN      8 /* don't try to run; just form the pnd_run.sh line and cache it */
+#define PND_EXEC_OPTION_INFO      16 /* for apps_exec_disco() only; implies that 'reserved' points to pnd_apps_exec_info_t struct */
+#define PND_EXEC_OPTION_FUTURE2   32
 
 unsigned char pnd_apps_exec ( char *pndrun, char *fullpath, char *unique_id,
                              char *rel_exec, char *rel_startdir,
+                             char *args,
                              unsigned int clockspeed, unsigned int options );
+char *pnd_apps_exec_runline ( void ); // returns the cached pnd_run.sh line from last PND_EXEC_OPTION_NORUN
+
+// this is a superior version of pnd_apps_exec(), but avoiding breaking the pnd_apps_exec() API to
+// extend it.
+// - same option booleans
+// - 'reserved' should be NULL unless you know what to put there (depends on options)
+// - 'app' should be a return from discovery, or a populated disco-t struct
+// - 'pndrun' is a reference to a pnd_run.sh script, to avoid seeking it out every time
+unsigned char pnd_apps_exec_disco ( char *pndrun, pnd_disco_t *app, unsigned int options, void *reserved );
+
+// for pnd_apps_exec_disco(), when option PND_EXEC_OPTION_INFO is used
+typedef struct {
+  char *viewer; // required; viewer's executable
+  char *args;   // optional; arg to viewer; ie: the file to view
+} pnd_apps_exec_info_t;
 
 // should you wish to know where an app will get mounted, call this function to obtain a guess. The
 // logic is wrapped up in pnd_run.sh, but in theory should be easily determined.