Skip to content

Commit

Permalink
Added desc-en and preview-pic[12] to the discovery struct; man, we ne…
Browse files Browse the repository at this point in the history
…ed to improve that whole disco-t thing someday :)
  • Loading branch information
skeezix committed Nov 11, 2009
1 parent 5bae873 commit 1aa0f59
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
5 changes: 5 additions & 0 deletions include/pnd_discovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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
Expand Down
11 changes: 11 additions & 0 deletions lib/pnd_discovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) );

Expand All @@ -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 ) );
}
Expand Down Expand Up @@ -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" );
Expand Down
11 changes: 10 additions & 1 deletion test/discotest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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 ) ) {
Expand Down

0 comments on commit 1aa0f59

Please sign in to comment.