Change -- minimenu was checking battery level every render (after most navigation...
[pandora-libraries.git] / apps / pnd_run.c
index 023fa73..29caf35 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;
     }
 
@@ -146,36 +139,50 @@ int main ( int argc, char *argv[] ) {
   }
 
   pnd_pxml_handle h = NULL;
+  pnd_pxml_handle *apps = NULL;
   if ( pnd_pnd_seek_pxml ( f ) ) {
     if ( pnd_pnd_accrue_pxml ( f, pxmlbuf, pxmlbuflen ) ) {
-      h = pnd_pxml_fetch_buffer ( "pnd_run", pxmlbuf );
+      apps = pnd_pxml_fetch_buffer ( "pnd_run", pxmlbuf );
     }
   }
 
   fclose ( f );
 
-  if ( ! h ) {
+  if ( ! apps ) {
     printf ( "ERROR: Couldn't pull PXML.xml from the pndfile.\n" );
     exit ( 0 );
   }
 
-  // attempt to invoke
-  unsigned int options = 0;
-  if ( no_x11 ) {
-    options |= PND_EXEC_OPTION_NOX11;
-  }
+  // attempt to invoke.. all of the subapps? just first one?
 
-  unsigned int clock = 200;
-  if ( pnd_pxml_get_clockspeed ( h ) ) {
-    clock = atoi ( pnd_pxml_get_clockspeed ( h ) );
-  }
+  while ( *apps ) {
+    h = *apps;
+
+    unsigned int options = 0;
+    if ( no_x11 ) {
+      options |= PND_EXEC_OPTION_NOX11;
+    }
+
+    unsigned int clock = 200;
+    if ( pnd_pxml_get_clockspeed ( h ) ) {
+      clock = atoi ( pnd_pxml_get_clockspeed ( h ) );
+    }
+
+    if ( ! pnd_apps_exec ( pnd_run, pndfile,
+                          pnd_pxml_get_unique_id ( h ),
+                          pnd_pxml_get_exec ( h ),
+                          pnd_pxml_get_startdir ( h ),
+                          NULL /* args */,
+                          clock,
+                          options )
+        )
+    {
+      printf ( "ERROR: PXML.xml data is bad\n" );
+    }
 
-  pnd_apps_exec ( pnd_run, pndfile,
-                 pnd_pxml_get_unique_id ( h ),
-                 pnd_pxml_get_exec ( h ),
-                 pnd_pxml_get_startdir ( h ),
-                 clock,
-                 options );
+    // next
+    apps++;
+  } // while
 
   return ( 0 );
 } // main