Added desc-en and preview-pic[12] to the discovery struct; man, we need to improve...
authorskeezix <skeezix@flotsam-vm.(none)>
Wed, 11 Nov 2009 15:20:13 +0000 (10:20 -0500)
committerskeezix <skeezix@flotsam-vm.(none)>
Wed, 11 Nov 2009 15:20:13 +0000 (10:20 -0500)
include/pnd_discovery.h
lib/pnd_discovery.c
test/discotest.c

index 97d8ebc..f41d10a 100644 (file)
@@ -41,6 +41,8 @@ typedef enum {
 // another struct? Have always intended discovery_t to have minimal members.. just enough to lead to an
 // application (PXML, xecutable, name); if the apps want more details, they can use the pnd_pxml code to
 // fetch the full PXML and get all the details. But I think we got out of control here :)
+// NOTE: We really need to rework disco-t so it can include non-english titles/desc; perhaps more info as optional,
+//   or a name/value pairing system so it can have extra data in it, without a complex structure.
 typedef struct {
   // base
   unsigned char object_type;   // see enum above
@@ -49,6 +51,7 @@ typedef struct {
   unsigned int pnd_icon_pos;   // offset to the byte after end of PXML in a pnd file (should be icon if present)
   // strdup'd from PXML -- hey, who was the idiot who thought it was a reat idea not to just re-use the pxml-struct?
   char *title_en;
+  char *desc_en;
   char *unique_id;
   char *icon;
   char *exec;
@@ -61,6 +64,8 @@ typedef struct {
   char *alt_category;
   char *alt_category1;
   char *alt_category2;
+  char *preview_pic1;
+  char *preview_pic2;
 } pnd_disco_t;
 
 void pnd_disco_destroy ( pnd_disco_t *p ); // a function name that simply could not be avoided
index c150f9f..b29f733 100644 (file)
@@ -139,6 +139,7 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
     if ( pnd_is_pxml_valid_app ( pxmlh ) ) {
       pnd_disco_t *p;
       char *fixpxml;
+      char *z;
 
       p = pnd_box_allocinsert ( disco_box, (char*) fpath, sizeof(pnd_disco_t) );
 
@@ -165,6 +166,9 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
       if ( pnd_pxml_get_app_name_en ( pxmlh ) ) {
        p -> title_en = strdup ( pnd_pxml_get_app_name_en ( pxmlh ) );
       }
+      if ( pnd_pxml_get_description_en ( pxmlh ) ) {
+       p -> desc_en = strdup ( pnd_pxml_get_description_en ( pxmlh ) );
+      }
       if ( pnd_pxml_get_icon ( pxmlh ) ) {
        p -> icon = strdup ( pnd_pxml_get_icon ( pxmlh ) );
       }
@@ -202,6 +206,13 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb,
       if ( pnd_pxml_get_altsubcategory2 ( pxmlh ) ) {
        p -> alt_category2 = strdup ( pnd_pxml_get_altsubcategory2 ( pxmlh ) );
       }
+      // preview pics
+      if ( ( z = pnd_pxml_get_previewpic1 ( pxmlh ) ) ) {
+       p -> preview_pic1 = strdup ( z );
+      }
+      if ( ( z = pnd_pxml_get_previewpic2 ( pxmlh ) ) ) {
+       p -> preview_pic2 = strdup ( z );
+      }
 
     } else {
       //printf ( "Invalid PXML; skipping.\n" );
index a1b3038..79e71fc 100644 (file)
@@ -124,7 +124,10 @@ int main ( int argc, char *argv[] ) {
       printf ( "  Base path: %s filename: %s\n", d -> object_path, d -> object_filename );
 
       if ( d -> title_en ) {
-       printf ( "  Name: %s\n", d -> title_en );
+       printf ( "  Name EN: %s\n", d -> title_en );
+      }
+      if ( d -> desc_en ) {
+       printf ( "  Desc EN: %s\n", d -> desc_en );
       }
       if ( d -> icon ) {
        printf ( "  Icon: %s\n", d -> icon );
@@ -147,6 +150,12 @@ int main ( int argc, char *argv[] ) {
       if ( d -> clockspeed ) {
        printf ( "  Clockspeed: %s\n", d -> clockspeed );
       }
+      if ( d -> preview_pic1 ) {
+       printf ( "  Preview Pic 1: %s\n", d -> preview_pic1 );
+      }
+      if ( d -> preview_pic2 ) {
+       printf ( "  Preview Pic 2: %s\n", d -> preview_pic2 );
+      }
 
       if ( do_icon ) {
        if ( pnd_emit_icon ( "./testdata/dotdesktop", d ) ) {