Hacked around pndnotifyd so it supports two sets of paths now -- menu path and deskto...
authorskeezix <skeezix@flotsam-vm.(none)>
Tue, 8 Dec 2009 21:35:19 +0000 (16:35 -0500)
committerskeezix <skeezix@flotsam-vm.(none)>
Tue, 8 Dec 2009 21:35:19 +0000 (16:35 -0500)
ie: apps are now in SD /pandora/desktop and /pandora/menu and go to their configured .desktop emit paths
TODO: fix up discotest and conftest to not look for apps.autodiscovery.searchpath but left it in for now

13 files changed:
Makefile
apps/pnd_run.c
apps/pndnotifyd.c
deployment/etc/pandora/conf/apps
deployment/etc/pandora/conf/desktop
include/pnd_apps.h
testdata/conf/apps
testdata/conf/desktop
testdata/doticons/jeff.sample.3.png [new file with mode: 0644]
testdata/doticons/skype-96fad0c.png [new file with mode: 0644]
testdata/menuapps/sampleapp9/PXML.xml [new file with mode: 0644]
testdata/menuapps/sampleapp9/program.exe [new file with mode: 0644]
testdata/menuapps/sampleapp9/zeldaicon.png [new file with mode: 0644]

index e17b2a1..fa52006 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ ALLOBJ = pnd_conf.o pnd_container.o pnd_discovery.o pnd_pxml.o pnd_notify.o pnd_
 all: ${SOLIB} ${LIB} conftest discotest notifytest pndnotifyd rawpxmltest pndvalidator loggertest pnd_run
 
 clean:
-       ${RM} -f ${ALLOBJ} ${XMLOBJ} ${LIB} ${SOLIB1} locatetest.o bin/locatetest conftest.o bin/conftest discotest.o bin/discotest loggertest.o bin/loggertest bin/notifytest notifytest.o bin/rawpxmltest rawpxmltest.o bin/pnd_run pnd_run.o bin/pndnotifyd pndnotifyd.o ${SOLIB} testdata/dotdesktop/*.desktop testdata/apps/*.pnd testdata/dotdesktop/*.png deployment/usr/lib/libpnd* deployment/usr/bin/pndnotifyd deployment/usr/pandora/scripts/* deployment/etc/sudoers deployment/etc/init.d/pndnotifyd bin/pndvalidator pndvalidator.o
+       ${RM} -f ${ALLOBJ} ${XMLOBJ} ${LIB} ${SOLIB1} locatetest.o bin/locatetest conftest.o bin/conftest discotest.o bin/discotest loggertest.o bin/loggertest bin/notifytest notifytest.o bin/rawpxmltest rawpxmltest.o bin/pnd_run pnd_run.o bin/pndnotifyd pndnotifyd.o ${SOLIB} testdata/dotdesktop/*.desktop testdata/menu/*.desktop testdata/apps/*.pnd testdata/dotdesktop/*.png deployment/usr/lib/libpnd* deployment/usr/bin/pndnotifyd deployment/usr/bin/pnd_run deployment/usr/pandora/scripts/* deployment/etc/sudoers deployment/etc/init.d/pndnotifyd bin/pndvalidator pndvalidator.o
        ${RM} -rf deployment/media
        find . -name "*~*" -exec rm {} \; -print
 
index 98b9bc7..c012ac6 100644 (file)
@@ -55,7 +55,6 @@ int main ( int argc, char *argv[] ) {
   // ---> cribbed right out of discotest :/ copypaste ftw!
   if ( ! pnd_run ) {
     char *configpath;
-    char *appspath;
     char *overridespath;
 
     // attempt to fetch a sensible default searchpath for configs
@@ -67,11 +66,6 @@ int main ( int argc, char *argv[] ) {
     apph = pnd_conf_fetch_by_id ( pnd_conf_apps, configpath );
 
     if ( apph ) {
-      appspath = pnd_conf_get_as_char ( apph, PND_APPS_KEY );
-
-      if ( ! appspath ) {
-       appspath = PND_APPS_SEARCHPATH;
-      }
 
       overridespath = pnd_conf_get_as_char ( apph, PND_PXML_OVERRIDE_KEY );
 
@@ -81,7 +75,6 @@ int main ( int argc, char *argv[] ) {
 
     } else {
       // couldn't find a useful app search path so use the default
-      appspath = PND_APPS_SEARCHPATH;
       overridespath = PND_PXML_OVERRIDE_SEARCHPATH;
     }
 
index 822c8f9..4d3d701 100644 (file)
@@ -48,13 +48,18 @@ typedef enum {
 
 // like discotest
 char *configpath;
-char *appspath;
 char *overridespath;
 // daemon stuff
 char *searchpath = NULL;
-char *dotdesktoppath = NULL;
-char *iconpath = NULL;
 char *notifypath = NULL;
+time_t createtime = 0; // all 'new' .destops are created at or after this time; prev are old.
+// dotfiles; this used to be a single pai .. now two pairs, a little unwieldy; pnd_box it up?
+char *desktop_dotdesktoppath = NULL;
+char *desktop_iconpath = NULL;
+char *desktop_appspath = NULL;
+char *menu_dotdesktoppath = NULL;
+char *menu_iconpath = NULL;
+char *menu_appspath = NULL;
 // pnd runscript
 char *run_searchpath; // searchpath to find pnd_run.sh
 char *run_script;     // name of pnd_run.sh script from config
@@ -70,6 +75,9 @@ pnd_notify_handle nh = 0;
 void consume_configuration ( void );
 void setup_notifications ( void );
 void sighup_handler ( int n );
+void process_discoveries ( pnd_box_handle applist, char *emitdesktoppath, char *emiticonpath );
+unsigned char perform_discoveries ( char *appspath, char *overridespath,
+                                   char *emitdesktoppath, char *emiticonpath );
 
 int main ( int argc, char *argv[] ) {
   // behaviour
@@ -145,12 +153,19 @@ int main ( int argc, char *argv[] ) {
   /* startup
    */
 
-  pnd_log ( pndn_rem, "Apps searchpath is '%s'\n", appspath );
   pnd_log ( pndn_rem, "PXML overrides searchpath is '%s'\n", overridespath );
-  pnd_log ( pndn_rem, ".desktop files emit to '%s'\n", dotdesktoppath );
-  pnd_log ( pndn_rem, ".desktop icon files emit to '%s'\n", iconpath );
   pnd_log ( pndn_rem, "Notify searchpath is '%s'\n", notifypath );
 
+  pnd_log ( pndn_rem, "Desktop apps ---------------------------------\n" );
+  pnd_log ( pndn_rem, "Apps searchpath is '%s'\n", desktop_appspath );
+  pnd_log ( pndn_rem, ".desktop files emit to '%s'\n", desktop_dotdesktoppath );
+  pnd_log ( pndn_rem, ".desktop icon files emit to '%s'\n", desktop_iconpath );
+
+  pnd_log ( pndn_rem, "Menu apps ---------------------------------\n" );
+  pnd_log ( pndn_rem, "Apps searchpath is '%s'\n", menu_appspath );
+  pnd_log ( pndn_rem, ".desktop files emit to '%s'\n", menu_dotdesktoppath );
+  pnd_log ( pndn_rem, ".desktop icon files emit to '%s'\n", menu_iconpath );
+
   /* set up signal handler
    */
   sigset_t ss;
@@ -180,8 +195,7 @@ int main ( int argc, char *argv[] ) {
     if ( scanonlaunch ||
         pnd_notify_rediscover_p ( nh ) )
     {
-      pnd_box_handle applist;
-      time_t createtime = time ( NULL ); // all 'new' .destops are created at or after this time; prev are old.
+      createtime = time ( NULL ); // all 'new' .destops are created at or after this time; prev are old.
 
       // if this was a forced scan, lets not do that next iteration
       if ( scanonlaunch ) {
@@ -194,153 +208,18 @@ int main ( int argc, char *argv[] ) {
       pnd_log ( pndn_rem, "------------------------------------------------------\n" );
       pnd_log ( pndn_rem, "Changes within watched paths .. performing re-discover!\n" );
 
-      // run the discovery
-      applist = pnd_disco_search ( appspath, overridespath );
-
-      // list the found apps (if any)
-      if ( applist ) {
-       pnd_disco_t *d = pnd_box_get_head ( applist );
-
-       while ( d ) {
-
-         pnd_log ( pndn_rem, "Found app: %s\n", pnd_box_get_key ( d ) );
-
-         // check if icon already exists (from a previous extraction say); if so, we needn't
-         // do it again
-         char existingpath [ FILENAME_MAX ];
-         sprintf ( existingpath, "%s/%s.png", iconpath, d -> unique_id );
-
-         struct stat dirs;
-         if ( stat ( existingpath, &dirs ) == 0 ) {
-           // icon seems to exist, so just crib the location into the .desktop
-
-           pnd_log ( pndn_rem, "  Found icon already existed, so reusing it! %s\n", existingpath );
-
-           if ( d -> icon ) {
-             free ( d -> icon );
-           }
-           d -> icon = strdup ( existingpath );
-
-         } else {
-           // icon seems unreadable or does not exist; lets try to create it..
-
-           pnd_log ( pndn_rem, "  Icon not already present, so trying to write it! %s\n", existingpath );
-
-           // attempt to create icon files; if successful, alter the disco struct to contain new
-           // path, otherwise leave it alone (since it could be a generic icon reference..)
-           if ( pnd_emit_icon ( iconpath, d ) ) {
-             // success; fix up icon path to new one..
-             if ( d -> icon ) {
-               free ( d -> icon );
-             }
-             d -> icon = strdup ( existingpath );
-           } else {
-             pnd_log ( pndn_rem, "  WARN: Couldn't write out icon %s\n", existingpath );
-           }
-
-         } // icon already exists?
-
-         // create the .desktop file
-         if ( pnd_emit_dotdesktop ( dotdesktoppath, pndrun, d ) ) {
-           // add a watch onto the newly created .desktop?
-#if 0
-           char buffer [ FILENAME_MAX ];
-           sprintf ( buffer, "%s/%s", dotdesktoppath, d -> unique_id );
-           pnd_notify_watch_path ( nh, buffer, PND_NOTIFY_RECURSE );
-#endif
-         } else {
-           pnd_log ( pndn_rem, "ERROR: Error creating .desktop file for app: %s\n", pnd_box_get_key ( d ) );
-         }
-
-         // next!
-         d = pnd_box_get_next ( d );
-
-       } // while applist
-
-      } else {
-
-       pnd_log ( pndn_rem, "No applications found in search path\n" );
-
-      } // got apps?
-
-      // run a clean up, to remove any dotdesktop files that we didn't
-      // just now create (that seem to have been created by pndnotifyd
-      // previously.) This allows SD eject (or .pnd remove) to remove
-      // an app from the launcher
-      //   NOTE: Could opendir and iterate across all .desktop files,
-      // removing any that have Source= something else, and that the
-      // app name is not in the list found in applist box above. But
-      // a cheesy simple way right now is to just remove .desktop files
-      // that have a last mod time prior to the time we stored above.
-      {
-       DIR *dir;
-
-       if ( ( dir = opendir ( dotdesktoppath ) ) ) {
-         struct dirent *dirent;
-         struct stat dirs;
-         char buffer [ FILENAME_MAX ];
-
-         while ( ( dirent = readdir ( dir ) ) ) {
-
-           // file is a .desktop?
-           if ( strstr ( dirent -> d_name, ".desktop" ) == NULL ) {
-             continue;
-           }
-
-           // figure out full path
-           sprintf ( buffer, "%s/%s", dotdesktoppath, dirent -> d_name );
-
-           // file was previously created by libpnd; check Source= line
-           // logic: default to 'yes' (in case we can't open the file for some reason)
-           //        if we can open the file, default to no and look for the source flag we added; if
-           //          that matches then we know its libpnd created, otherwise assume not.
-           unsigned char source_libpnd = 1;
-           {
-             char line [ 256 ];
-             FILE *grep = fopen ( buffer, "r" );
-             if ( grep ) {
-               source_libpnd = 0;
-               while ( fgets ( line, 255, grep ) ) {
-                 if ( strcasestr ( line, PND_DOTDESKTOP_SOURCE ) ) {
-                   source_libpnd = 2;
-                 }
-               } // while
-               fclose ( grep );
-             }
-           }
-           if ( source_libpnd ) {
-#if 0
-             pnd_log ( pndn_rem,
-                       "File '%s' appears to have been created by libpnd so candidate for delete: %u\n", buffer, source_libpnd );
-#endif
-           } else {
-#if 0
-             pnd_log ( pndn_rem, "File '%s' appears NOT to have been created by libpnd, so leave it alone\n", buffer );
-#endif
-             continue; // skip deleting it
-           }
-
-           // file is 'new'?
-           if ( stat ( buffer, &dirs ) == 0 ) {
-             if ( dirs.st_mtime >= createtime ) {
-#if 0
-               pnd_log ( pndn_rem, "File '%s' seems 'new', so leave it alone.\n", buffer );
-#endif
-               continue; // skip deleting it
-             }
-           }
+      /* run the discovery
+       */
 
-           // by this point, the .desktop file must be 'old' and created by pndnotifyd
-           // previously, so can remove it
-           pnd_log ( pndn_rem, "File '%s' seems nolonger relevent; removing it.\n", dirent -> d_name );
-           unlink ( buffer );
-
-         } // while getting filenames from dir
-
-         closedir ( dir );
-       }
+      pnd_log ( pndn_rem, "Scanning desktop paths----------------------------\n" );
+      if ( ! perform_discoveries ( desktop_appspath, overridespath, desktop_dotdesktoppath, desktop_iconpath ) ) {
+       pnd_log ( pndn_rem, "No applications found in desktop search path\n" );
+      }
 
-      } // purge old .desktop files
+      pnd_log ( pndn_rem, "Scanning menu paths----------------------------\n" );
+      if ( ! perform_discoveries ( menu_appspath, overridespath, menu_dotdesktoppath, menu_iconpath ) ) {
+       pnd_log ( pndn_rem, "No applications found in menu search path\n" );
+      }
 
       // if we've got a hup script located, lets invoke it
       if ( pndhup ) {
@@ -380,12 +259,6 @@ void consume_configuration ( void ) {
 
   if ( apph ) {
 
-    appspath = pnd_conf_get_as_char ( apph, PND_APPS_KEY );
-
-    if ( ! appspath ) {
-      appspath = PND_APPS_SEARCHPATH;
-    }
-
     overridespath = pnd_conf_get_as_char ( apph, PND_PXML_OVERRIDE_KEY );
 
     if ( ! overridespath ) {
@@ -400,34 +273,47 @@ void consume_configuration ( void ) {
 
   } else {
     // couldn't find a useful app search path so use the default
-    appspath = PND_APPS_SEARCHPATH;
     overridespath = PND_PXML_OVERRIDE_SEARCHPATH;
     notifypath = PND_APPS_NOTIFYPATH;
   }
 
-  // attempt to figure out where to drop dotfiles
+  // attempt to figure out where to drop dotfiles .. now that we're going
+  // multi-target we see the limit of my rudimentary conf-file parser; should
+  // just parse to an array of targets, rather that hardcoding two, but
+  // on the other hand, don't likely see the need for more than two? (famous
+  // last words.)
   pnd_conf_handle desktoph;
 
   desktoph = pnd_conf_fetch_by_id ( pnd_conf_desktop, configpath );
 
+  // for 'desktop' main applications
   if ( desktoph ) {
-    dotdesktoppath = pnd_conf_get_as_char ( desktoph, PND_DOTDESKTOP_KEY );
+    desktop_dotdesktoppath = pnd_conf_get_as_char ( desktoph, PND_DESKTOP_DOTDESKTOP_PATH_KEY );
+    desktop_iconpath = pnd_conf_get_as_char ( desktoph, PND_DESKTOP_ICONS_PATH_KEY );
+    desktop_appspath = pnd_conf_get_as_char ( desktoph, PND_DESKTOP_SEARCH_KEY );
+  }
 
-    if ( ! dotdesktoppath ) {
-      dotdesktoppath = PND_DOTDESKTOP_DEFAULT;
-    }
+  if ( ! desktop_dotdesktoppath ) {
+    desktop_dotdesktoppath = PND_DESKTOP_DOTDESKTOP_PATH_DEFAULT;
+  }
 
-    iconpath = pnd_conf_get_as_char ( desktoph, PND_DOTDESKTOPICONS_KEY );
+  if ( ! desktop_iconpath ) {
+    desktop_iconpath = PND_DESKTOP_ICONS_PATH_DEFAULT;
+  }
 
-    if ( ! iconpath ) {
-      iconpath = PND_DOTDESKTOPICONS_DEFAULT;
-    }
+  if ( ! desktop_appspath ) {
+    desktop_appspath = PND_DESKTOP_SEARCH_PATH_DEFAULT;
+  }
 
-  } else {
-    dotdesktoppath = PND_DOTDESKTOPICONS_DEFAULT;
+  // for 'menu' applications
+  if ( desktoph ) {
+    menu_dotdesktoppath = pnd_conf_get_as_char ( desktoph, PND_MENU_DOTDESKTOP_PATH_KEY );
+    menu_iconpath = pnd_conf_get_as_char ( desktoph, PND_MENU_ICONS_PATH_KEY );
+    menu_appspath = pnd_conf_get_as_char ( desktoph, PND_MENU_SEARCH_KEY );
   }
 
-  // try to locate a runscript and optional hupscript
+  /* try to locate a runscript and optional hupscript
+   */
 
   if ( apph ) {
     run_searchpath = pnd_conf_get_as_char ( apph, PND_PNDRUN_SEARCHPATH_KEY );
@@ -491,13 +377,19 @@ void consume_configuration ( void ) {
 
   /* handle globbing or variable substitution
    */
-  dotdesktoppath = pnd_expand_tilde ( strdup ( dotdesktoppath ) );
-  iconpath = pnd_expand_tilde ( strdup ( iconpath ) );
-
-  /* validate paths
-   */
-  mkdir ( dotdesktoppath, 0777 );
-  mkdir ( iconpath, 0777 );
+  desktop_dotdesktoppath = pnd_expand_tilde ( strdup ( desktop_dotdesktoppath ) );
+  desktop_iconpath = pnd_expand_tilde ( strdup ( desktop_iconpath ) );
+  mkdir ( desktop_dotdesktoppath, 0777 );
+  mkdir ( desktop_iconpath, 0777 );
+
+  if ( menu_dotdesktoppath ) {
+    menu_dotdesktoppath = pnd_expand_tilde ( strdup ( menu_dotdesktoppath ) );
+    mkdir ( menu_dotdesktoppath, 0777 );
+  }
+  if ( menu_iconpath ) {
+    menu_iconpath = pnd_expand_tilde ( strdup ( menu_iconpath ) );
+    mkdir ( menu_iconpath, 0777 );
+  }
 
   // done
   return;
@@ -554,3 +446,169 @@ void sighup_handler ( int n ) {
 
   return;
 }
+
+// This very recently was inline code; just slight refactor to functionize it so that it can be
+// reused in a couple of places. Simple code with simple design quickly became too large for
+// its simple design; should revisit a lot of these little things..
+void process_discoveries ( pnd_box_handle applist, char *emitdesktoppath, char *emiticonpath ) {
+  pnd_disco_t *d = pnd_box_get_head ( applist );
+
+  while ( d ) {
+
+    pnd_log ( pndn_rem, "Found app: %s\n", pnd_box_get_key ( d ) );
+
+    // check if icon already exists (from a previous extraction say); if so, we needn't
+    // do it again
+    char existingpath [ FILENAME_MAX ];
+    sprintf ( existingpath, "%s/%s.png", emiticonpath, d -> unique_id );
+
+    struct stat dirs;
+    if ( stat ( existingpath, &dirs ) == 0 ) {
+      // icon seems to exist, so just crib the location into the .desktop
+
+      pnd_log ( pndn_rem, "  Found icon already existed, so reusing it! %s\n", existingpath );
+
+      if ( d -> icon ) {
+       free ( d -> icon );
+      }
+      d -> icon = strdup ( existingpath );
+
+    } else {
+      // icon seems unreadable or does not exist; lets try to create it..
+
+      pnd_log ( pndn_debug, "  Icon not already present, so trying to write it! %s\n", existingpath );
+
+      // attempt to create icon files; if successful, alter the disco struct to contain new
+      // path, otherwise leave it alone (since it could be a generic icon reference..)
+      if ( pnd_emit_icon ( emiticonpath, d ) ) {
+       // success; fix up icon path to new one..
+       if ( d -> icon ) {
+         free ( d -> icon );
+       }
+       d -> icon = strdup ( existingpath );
+      } else {
+       pnd_log ( pndn_debug, "  WARN: Couldn't write out icon %s\n", existingpath );
+      }
+
+    } // icon already exists?
+
+    // create the .desktop file
+    if ( pnd_emit_dotdesktop ( emitdesktoppath, pndrun, d ) ) {
+      // add a watch onto the newly created .desktop?
+#if 0
+      char buffer [ FILENAME_MAX ];
+      sprintf ( buffer, "%s/%s", emitdesktoppath, d -> unique_id );
+      pnd_notify_watch_path ( nh, buffer, PND_NOTIFY_RECURSE );
+#endif
+    } else {
+      pnd_log ( pndn_rem, "ERROR: Error creating .desktop file for app: %s\n", pnd_box_get_key ( d ) );
+    }
+
+    // next!
+    d = pnd_box_get_next ( d );
+
+  } // while applist
+
+  return;
+}
+
+// returns true if any applications were found
+unsigned char perform_discoveries ( char *appspath, char *overridespath,              // args to do discovery
+                                   char *emitdesktoppath, char *emiticonpath )       // args to do emitting
+{
+  pnd_box_handle applist;
+
+  // attempt to auto-discover applications in the given path
+  applist = pnd_disco_search ( appspath, overridespath );
+
+  if ( ! applist ) {
+    return ( 0 );
+  }
+
+  process_discoveries ( applist, emitdesktoppath, emiticonpath );
+
+  // run a clean up, to remove any dotdesktop files that we didn't
+  // just now create (that seem to have been created by pndnotifyd
+  // previously.) This allows SD eject (or .pnd remove) to remove
+  // an app from the launcher
+  //   NOTE: Could opendir and iterate across all .desktop files,
+  // removing any that have Source= something else, and that the
+  // app name is not in the list found in applist box above. But
+  // a cheesy simple way right now is to just remove .desktop files
+  // that have a last mod time prior to the time we stored above.
+  {
+    DIR *dir;
+
+    if ( ( dir = opendir ( emitdesktoppath ) ) ) {
+      struct dirent *dirent;
+      struct stat dirs;
+      char buffer [ FILENAME_MAX ];
+
+      while ( ( dirent = readdir ( dir ) ) ) {
+
+       // file is a .desktop?
+       if ( strstr ( dirent -> d_name, ".desktop" ) == NULL ) {
+         continue;
+       }
+
+       // figure out full path
+       sprintf ( buffer, "%s/%s", emitdesktoppath, dirent -> d_name );
+
+       // file was previously created by libpnd; check Source= line
+       // logic: default to 'yes' (in case we can't open the file for some reason)
+       //        if we can open the file, default to no and look for the source flag we added; if
+       //          that matches then we know its libpnd created, otherwise assume not.
+       unsigned char source_libpnd = 1;
+       {
+         char line [ 256 ];
+         FILE *grep = fopen ( buffer, "r" );
+         if ( grep ) {
+           source_libpnd = 0;
+           while ( fgets ( line, 255, grep ) ) {
+             if ( strcasestr ( line, PND_DOTDESKTOP_SOURCE ) ) {
+               source_libpnd = 2;
+             }
+           } // while
+           fclose ( grep );
+         }
+       }
+       if ( source_libpnd ) {
+#if 0
+         pnd_log ( pndn_rem,
+                   "File '%s' appears to have been created by libpnd so candidate for delete: %u\n", buffer, source_libpnd );
+#endif
+       } else {
+#if 0
+         pnd_log ( pndn_rem, "File '%s' appears NOT to have been created by libpnd, so leave it alone\n", buffer );
+#endif
+         continue; // skip deleting it
+       }
+
+       // file is 'new'?
+       if ( stat ( buffer, &dirs ) == 0 ) {
+         if ( dirs.st_mtime >= createtime ) {
+#if 0
+           pnd_log ( pndn_rem, "File '%s' seems 'new', so leave it alone.\n", buffer );
+#endif
+           continue; // skip deleting it
+         }
+       }
+
+       // by this point, the .desktop file must be 'old' and created by pndnotifyd
+       // previously, so can remove it
+       pnd_log ( pndn_rem, "File '%s' seems nolonger relevent; removing it.\n", dirent -> d_name );
+       unlink ( buffer );
+
+      } // while getting filenames from dir
+
+      closedir ( dir );
+    }
+
+  } // purge old .desktop files
+
+  //WARN: MEMORY LEAK HERE
+  pnd_log ( pndn_debug, "pndnotifyd - memory leak here - perform_discoveries()\n" );
+  pnd_box_delete ( applist ); // does not free the disco_t contents!
+
+  return ( 1 );
+}
index 9040efe..ecf98e4 100644 (file)
@@ -7,7 +7,7 @@
 searchpath     /media/*/pandora/apps:/usr/pandora/apps
 # notifypath is a list of paths to monitor; if anything in those paths changes, the searchpath is rescanned
 # note that for each path chunk, all current subdirs of that path are also watched)
-notifypath     /media:/media/*/pandora/apps:/usr/pandora/apps:./testdata/app?
+notifypath     /media:/media/*/pandora/apps:/usr/pandora/apps
 
 # PXMLs may be overridden .. ie: overrides are a subset of PXML, where the values are copied over the full PXML
 [overrides]
@@ -16,7 +16,8 @@ searchpath    ~/pxml-overrides
 
 # [pnd] defines where to locate the pnd support scripts, so the user may override pnd_run.sh without clobbering built in
 [pnd]
-searchpath     /media/*/pandora/scripts:/usr/pandora/scripts
+# if you wish to make pnd_run.sh etc be findable on SD, prepend "/media/*/pandora/scripts:" to the 'searchpath'
+searchpath     /usr/pandora/scripts
 runscript      pnd_run.sh
 
 # [pndnotifyd] sets some extra pndnotifyd specific items
index b45fccf..55f3975 100644 (file)
@@ -2,10 +2,15 @@
 # Open Pandora
 # Desktop configuration
 
-[dotfiles]
-#(~/Desktop for xfce, /usr/share/applications for WMs that actually follow spec)
+[desktop]
+searchpath     /mnt/sd?/pandora/desktop:/usr/pandora/apps      # path to depth-search for PXMLs and pnd-files
 dotdesktoppath ~/Desktop/      # path for pndnotifyd to spit .desktop files into (run as root)
-iconpath       /tmp    # path for pndnotifyd to drop icons into (can be same as .desktop if WM permits)
+iconpath       /tmp    # path for pndnotifyd to drop icons into (can be same as dotdesktoppath if WM permits)
+
+[menu]
+searchpath     /mnt/sd?/pandora/menu   # path to depth-search for PXMLs and pnd-files
+dotdesktoppath /tmp/menu               # path for pndnotifyd to spit .desktop files into
+iconpath       /tmp/menuicons  # path for pndnotifyd to drop icons into (can be same as dotdesktoppath if WM permits)
 
 [launcher]
 # if hupscript is commented out entirely, pndnotifyd will not try to find/run the hup
index 51939f9..9e56333 100644 (file)
@@ -25,10 +25,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 "./"
index f7ab2c2..4f9a01e 100644 (file)
@@ -18,4 +18,4 @@ runscript     pnd_run.sh
 # [pndnotifyd] sets some extra pndnotifyd specific items
 [pndnotifyd]
 # logging level 0 means to include debug; level 1 (regular), 2 (warnings), 3 (errors)
-loglevel       0
+loglevel       1
index 4b1e994..6e3d6ca 100644 (file)
@@ -2,10 +2,15 @@
 # Open Pandora
 # Desktop configuration
 
-[dotfiles]
-#dotdesktoppath        ./testdata/dotdesktop   # path for pndnotifyd to spit .desktop files into
-dotdesktoppath ~/.applications         # path for pndnotifyd to spit .desktop files into
-iconpath       ./testdata/dotdesktop   # path for pndnotifyd to drop icons into (can be same as .desktop if WM permits)
+[desktop]
+searchpath     /mnt/sd?/pandora/desktop:./testdata/app?        # path to depth-search for PXMLs and pnd-files
+dotdesktoppath ./testdata/dotdesktop   # path for pndnotifyd to spit .desktop files into
+iconpath       ./testdata/doticons     # path for pndnotifyd to drop icons into (can be same as dotdesktoppath if WM permits)
+
+[menu]
+searchpath     /mnt/sd?/pandora/menu:./testdata/menuapps       # path to depth-search for PXMLs and pnd-files
+dotdesktoppath ./testdata/menu         # path for pndnotifyd to spit .desktop files into
+iconpath       ./testdata/menuicons    # path for pndnotifyd to drop icons into (can be same as dotdesktoppath if WM permits)
 
 [launcher]
 hupscript      pnd_hup.sh
diff --git a/testdata/doticons/jeff.sample.3.png b/testdata/doticons/jeff.sample.3.png
new file mode 100644 (file)
index 0000000..140a393
Binary files /dev/null and b/testdata/doticons/jeff.sample.3.png differ
diff --git a/testdata/doticons/skype-96fad0c.png b/testdata/doticons/skype-96fad0c.png
new file mode 100644 (file)
index 0000000..e61f838
Binary files /dev/null and b/testdata/doticons/skype-96fad0c.png differ
diff --git a/testdata/menuapps/sampleapp9/PXML.xml b/testdata/menuapps/sampleapp9/PXML.xml
new file mode 100644 (file)
index 0000000..2d59722
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PXML xmlns="http://openpandora.org/namespaces/PXML" 
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="jeff.sample.9" xsi:noNamespaceSchemaLocation="PXML_schema.xsd">
+  <title lang="en_US">Sample App 9</title>
+  <title lang="de_DE">Sample App 9 - German</title>
+
+  <exec background="true" startdir="/usr/share/icons/" standalone="true" command="program.exe"/>
+
+  <description lang="en_US">This is the English Description of the file.</description>
+  <description lang="de_DE">This would be the German description.</description>
+
+  <previewpics>
+    <pic src="./preview/pic1.jpg"/>
+    <pic src="./preview/pic2.jpg"/>
+  </previewpics>
+
+  <author name="EvilDragon" website="http://www.openpandora.org"/><!--Optional email and website, name required-->
+
+  <version major="1" minor="1" release="1" build="2"/><!--This program's version-->
+  <osversion major="1" minor="0" release="0" build="0"/><!--The minimum OS version required-->
+
+  <categories>
+    <category name="MainCategory"><!--category like "Games", "Graphics", "Internet" etc-->
+      <subcategory name="Subcategory1"/><!--subcategory, like "Board Games", "Strategy", "First Person Shooters"-->
+      <subcategory name="Subcategory2"/>
+    </category>
+    <category name="AlternativeCategory">
+      <subcategory name="AlternativeSubcategory1"/>
+    </category>
+  </categories>
+
+  <associations>
+    <!--File associations, with a short description, an extension, and start params.-->
+    <association name="View Word File" filetype="application/msword" exec="-f %s -t doc"/>
+  </associations>
+
+  <clockspeed frequency="600"/><!--Frequency in Hz-->
+
+  <configuration for="gmenupandora">......kfujl........</configuration><!--random data, this is for specific menus-->
+  <configuration for="anothermenu">......qwe......fwer.....</configuration>
+</PXML>
diff --git a/testdata/menuapps/sampleapp9/program.exe b/testdata/menuapps/sampleapp9/program.exe
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/testdata/menuapps/sampleapp9/zeldaicon.png b/testdata/menuapps/sampleapp9/zeldaicon.png
new file mode 100644 (file)
index 0000000..140a393
Binary files /dev/null and b/testdata/menuapps/sampleapp9/zeldaicon.png differ