mmenu; better handling where a suncategory name is available to multiple parent categ...
[pandora-libraries.git] / lib / pnd_tinyxml.cpp
index 59f7e4d..2c6d4e9 100644 (file)
@@ -53,7 +53,7 @@ unsigned char pnd_pxml_parse_titles(const TiXmlHandle hRoot, pnd_pxml_t *app) {
     title->language = lang;
     title->string = text;
 
-    pnd_log ( PND_LOG_DEFAULT, (char*)"    Title/Lang: %s/%s\n", text, lang );
+    //pnd_log ( PND_LOG_DEFAULT, (char*)"    Title/Lang: %s/%s\n", text, lang );
 
   }
 
@@ -80,24 +80,25 @@ unsigned char pnd_pxml_parse_descriptions(const TiXmlHandle hRoot, pnd_pxml_t *a
            continue;
          }
 
-               char *text = strdup(pElem->GetText());
-               if (!text) continue;
+         char *text = strdup(pElem->GetText());
+         if (!text) continue;
 
-               char *lang = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_DESCRLANG);
-               if (!lang) continue;
+         char *lang = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_DESCRLANG);
+         if (!lang) continue;
 
-               app->descriptions_c++;
-               if (app->descriptions_c > app->descriptions_alloc_c) //we don't have enough strings allocated
-               {
-                       app->descriptions_alloc_c <<= 1;
-                       app->descriptions = (pnd_localized_string_t*)realloc((void*)app->descriptions, app->descriptions_alloc_c);
-                       if (!app->descriptions) return (0); //errno = ENOMEM
-               }
+         app->descriptions_c++;
+         if (app->descriptions_c > app->descriptions_alloc_c) //we don't have enough strings allocated
+         {
+           app->descriptions_alloc_c <<= 1;
+           app->descriptions = (pnd_localized_string_t*)realloc((void*)app->descriptions, app->descriptions_alloc_c * sizeof(pnd_localized_string_t) );
+           if (!app->descriptions) return (0); //errno = ENOMEM
+         }
 
-               pnd_localized_string_t *description = &app->descriptions[app->descriptions_c - 1];
-               description->language = lang;
-               description->string = text;
+         pnd_localized_string_t *description = &app->descriptions[app->descriptions_c - 1];
+         description->language = lang;
+         description->string = text;
        }
+
        return (1);
 }
 
@@ -140,7 +141,7 @@ unsigned char pnd_pxml_parse ( const char *pFilename, char *buffer, unsigned int
   // until we run out of applications in the PXML..
   while ( 1 ) {
 
-    pnd_log ( PND_LOG_DEFAULT, (char*)"  App #%u inside of PXML %s\n", appcount, pFilename );
+    //pnd_log ( PND_LOG_DEFAULT, (char*)"  App #%u inside of PXML %s\n", appcount, pFilename );
 
     // create the buffer to hold the pxml
     apps [ appcount ] = (pnd_pxml_t*) malloc ( sizeof(pnd_pxml_t) );
@@ -157,10 +158,11 @@ unsigned char pnd_pxml_parse ( const char *pFilename, char *buffer, unsigned int
     //Get unique ID first.
     if ( appwrappermode ) {
       app->unique_id = pnd_pxml_get_attribute(appElem, PND_PXML_ATTRNAME_UID);
-      pnd_log ( PND_LOG_DEFAULT, (char*)"  Subapp #%u has unique_id %s\n", appcount, app -> unique_id );
+      //pnd_log ( PND_LOG_DEFAULT, (char*)"  Subapp #%u has unique_id %s\n", appcount, app -> unique_id );
+      app->appdata_dirname = pnd_pxml_get_attribute(appElem, PND_PXML_ATTRNAME_APPDATANAME);
     } else {
       app->unique_id = pnd_pxml_get_attribute(hRoot.Element(), PND_PXML_ATTRNAME_UID);
-      pnd_log ( PND_LOG_DEFAULT, (char*)"  Only-app #%u has unique_id %s\n", appcount, app -> unique_id );
+      //pnd_log ( PND_LOG_DEFAULT, (char*)"  Only-app #%u has unique_id %s\n", appcount, app -> unique_id );
     }
 
     //Everything related to the title:
@@ -177,6 +179,7 @@ unsigned char pnd_pxml_parse ( const char *pFilename, char *buffer, unsigned int
        app->exec       = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_EXECCMD);
        app->startdir   = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_EXECWD);
        app->exec_no_x11     = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_EXECNOX11);
+       app->execargs   = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_EXECARGS);
      }
 
     //The app icon:
@@ -184,6 +187,14 @@ unsigned char pnd_pxml_parse ( const char *pFilename, char *buffer, unsigned int
       app->icon       = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_ICONSRC);
     }
 
+    // <info>
+    if ( (pElem = hRoot.FirstChild(PND_PXML_ENAME_INFO).Element()) )
+     {
+       app-> info_name = pnd_pxml_get_attribute ( pElem, PND_PXML_ATTRNAME_INFONAME );
+       app-> info_filename = pnd_pxml_get_attribute ( pElem, PND_PXML_ATTRNAME_INFOSRC );
+       app-> info_type = pnd_pxml_get_attribute ( pElem, PND_PXML_ATTRNAME_INFOTYPE );
+     }
+
     //The preview pics:
     if ( (pElem = hRoot.FirstChild(PND_PXML_NODENAME_PREVPICS).Element()) )
     {
@@ -372,7 +383,7 @@ unsigned char pnd_pxml_parse ( const char *pFilename, char *buffer, unsigned int
     if ( appwrappermode ) {
       appElem = appElem -> NextSiblingElement ( PND_PXML_APP );
       if ( ! appElem ) {
-       pnd_log ( PND_LOG_DEFAULT, (char*)"  No more applications within PXML\n" );
+       //pnd_log ( PND_LOG_DEFAULT, (char*)"  No more applications within PXML\n" );
        break; // no more applications
       }
       // got another application..