Stick <info> element into PXML.xml .. parser, disco-t, pxml-t
[pandora-libraries.git] / lib / pnd_discovery.c
index 88a1126..eeee25e 100644 (file)
@@ -28,6 +28,7 @@ void pnd_disco_destroy ( pnd_disco_t *p ) {
   if ( p -> unique_id ) {      free ( p -> unique_id );   }
   if ( p -> icon )     {       free ( p -> icon );        }
   if ( p -> exec )     {       free ( p -> exec );        }
+  if ( p -> execargs ) {       free ( p -> execargs );    }
   if ( p -> clockspeed ) {     free ( p -> clockspeed );  }
   if ( p -> startdir ) {       free ( p -> startdir );    }
   if ( p -> option_no_x11 ) {  free ( p -> option_no_x11 );  }
@@ -38,6 +39,9 @@ void pnd_disco_destroy ( pnd_disco_t *p ) {
   if ( p -> alt_category1 ) {  free ( p -> alt_category1 );  }
   if ( p -> alt_category2 ) {  free ( p -> alt_category2 );  }
   if ( p -> mkdir_sp )      {  free ( p -> mkdir_sp );       }
+  if ( p -> info_name )     {  free ( p -> info_name );       }
+  if ( p -> info_type )     {  free ( p -> info_type );       }
+  if ( p -> info_filename ) {  free ( p -> info_filename );       }
 
   return;
 }
@@ -172,7 +176,9 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
     }
 
     // look for any overrides, if requested
-    pnd_pxml_merge_override ( pxmlh, disco_overrides );
+    if ( disco_overrides ) {
+      pnd_pxml_merge_override ( pxmlh, disco_overrides );
+    }
 
     // check for validity and add to resultset if it looks executable
     if ( pnd_is_pxml_valid_app ( pxmlh ) ) {
@@ -180,7 +186,7 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
       char *fixpxml;
       char *z;
 
-      pnd_log ( PND_LOG_DEFAULT, "Setting up discovered app %u\n", ((pnd_pxml_t*) pxmlh) -> subapp_number );
+      //pnd_log ( PND_LOG_DEFAULT, "Setting up discovered app %u\n", ((pnd_pxml_t*) pxmlh) -> subapp_number );
 
       p = pnd_box_allocinsert ( disco_box, (char*) fpath, sizeof(pnd_disco_t) );
 
@@ -219,6 +225,9 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
       if ( pnd_pxml_get_exec ( pxmlh ) ) {
        p -> exec = strdup ( pnd_pxml_get_exec ( pxmlh ) );
       }
+      if ( pnd_pxml_get_execargs ( pxmlh ) ) {
+       p -> execargs = strdup ( pnd_pxml_get_execargs ( pxmlh ) );
+      }
       if ( pnd_pxml_get_exec_option_no_x11 ( pxmlh ) ) {
        p -> option_no_x11 = strdup ( pnd_pxml_get_exec_option_no_x11 ( pxmlh ) );
       }
@@ -261,6 +270,16 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
       if ( pnd_pxml_get_mkdir ( pxmlh ) ) {
        p -> mkdir_sp = strdup ( pnd_pxml_get_mkdir ( pxmlh ) );
       }
+      // info
+      if ( pnd_pxml_get_info_src ( pxmlh ) ) {
+       p -> info_filename = strdup ( pnd_pxml_get_info_src ( pxmlh ) );
+      }
+      if ( pnd_pxml_get_info_name ( pxmlh ) ) {
+       p -> info_name = strdup ( pnd_pxml_get_info_name ( pxmlh ) );
+      }
+      if ( pnd_pxml_get_info_type ( pxmlh ) ) {
+       p -> info_type = strdup ( pnd_pxml_get_info_type ( pxmlh ) );
+      }
 
     } else {
       //printf ( "Invalid PXML; skipping.\n" );