From 020f0555fd57745e14c1e388884c4f63272d8562 Mon Sep 17 00:00:00 2001 From: skeezix Date: Mon, 23 Feb 2009 16:06:05 -0500 Subject: [PATCH] merge some cpas changes in for the PXML.[ch] fields --- TODO.txt | 2 + include/pnd_pxml.h | 44 +++++- lib/pnd_discovery.c | 16 +- lib/pnd_pxml.c | 358 +++++++++++++++++++++++++++++++++++++++----- 4 files changed, 372 insertions(+), 48 deletions(-) diff --git a/TODO.txt b/TODO.txt index 58ae80f..90e253e 100644 --- a/TODO.txt +++ b/TODO.txt @@ -13,6 +13,8 @@ Some things to be done.. - make accrused PXML from pnd-buffer growable, not locked at 32k/X size +- make sensible override code, so it picks up all fields... or compares fields; not just copies _en + apps/pndnotifyd.c:// TODO: Catch HUP and reparse config apps/pndnotifyd.c:// TODO: Should perhaps direct all printf's through a vsprintf handler to avoid redundant "if ! g_daemon_mode" apps/pndnotifyd.c:// TODO: During daemon mode, should perhaps syslog or log errors diff --git a/include/pnd_pxml.h b/include/pnd_pxml.h index f8fbbbb..775aef0 100644 --- a/include/pnd_pxml.h +++ b/include/pnd_pxml.h @@ -38,12 +38,48 @@ signed char pnd_pxml_merge_override ( pnd_pxml_handle h, char *searchpath ); /* these accessor functions will return READ ONLY char*s; do not free them or modify them. */ -char *pnd_pxml_get_app_name ( pnd_pxml_handle h ); -char *pnd_pxml_get_icon_path ( pnd_pxml_handle h ); +char *pnd_pxml_get_app_name_en ( pnd_pxml_handle h ); +char *pnd_pxml_get_app_name_de ( pnd_pxml_handle h ); +char *pnd_pxml_get_app_name_it ( pnd_pxml_handle h ); +char *pnd_pxml_get_app_name_fr ( pnd_pxml_handle h ); char *pnd_pxml_get_unique_id ( pnd_pxml_handle h ); -char *pnd_pxml_get_primary_category ( pnd_pxml_handle h ); -char *pnd_pxml_get_exec_path ( pnd_pxml_handle h ); +char *pnd_pxml_get_standalone ( pnd_pxml_handle h ); +char *pnd_pxml_get_icon ( pnd_pxml_handle h ); +char *pnd_pxml_get_description_en ( pnd_pxml_handle h ); +char *pnd_pxml_get_description_de ( pnd_pxml_handle h ); +char *pnd_pxml_get_description_it ( pnd_pxml_handle h ); +char *pnd_pxml_get_description_fr ( pnd_pxml_handle h ); +char *pnd_pxml_get_previewpic1 ( pnd_pxml_handle h ); +char *pnd_pxml_get_previewpic2 ( pnd_pxml_handle h ); +char *pnd_pxml_get_author_name ( pnd_pxml_handle h ); +char *pnd_pxml_get_author_website ( pnd_pxml_handle h ); +char *pnd_pxml_get_version_major ( pnd_pxml_handle h ); +char *pnd_pxml_get_version_minor ( pnd_pxml_handle h ); +char *pnd_pxml_get_version_release ( pnd_pxml_handle h ); +char *pnd_pxml_get_version_build ( pnd_pxml_handle h ); +char *pnd_pxml_get_exec ( pnd_pxml_handle h ); +char *pnd_pxml_get_main_category ( pnd_pxml_handle h ); +char *pnd_pxml_get_subcategory1 ( pnd_pxml_handle h ); +char *pnd_pxml_get_subcategory2 ( pnd_pxml_handle h ); +char *pnd_pxml_get_altcategory ( pnd_pxml_handle h ); +char *pnd_pxml_get_altsubcategory1 ( pnd_pxml_handle h ); +char *pnd_pxml_get_altsubcategory2 ( pnd_pxml_handle h ); +char *pnd_pxml_get_osversion_major ( pnd_pxml_handle h ); +char *pnd_pxml_get_osversion_minor ( pnd_pxml_handle h ); +char *pnd_pxml_get_osversion_release ( pnd_pxml_handle h ); +char *pnd_pxml_get_osversion_build ( pnd_pxml_handle h ); +char *pnd_pxml_get_associationitem1_name ( pnd_pxml_handle h ); +char *pnd_pxml_get_associationitem1_filetype ( pnd_pxml_handle h ); +char *pnd_pxml_get_associationitem1_parameter ( pnd_pxml_handle h ); +char *pnd_pxml_get_associationitem2_name ( pnd_pxml_handle h ); +char *pnd_pxml_get_associationitem2_filetype ( pnd_pxml_handle h ); +char *pnd_pxml_get_associationitem2_parameter ( pnd_pxml_handle h ); +char *pnd_pxml_get_associationitem3_name ( pnd_pxml_handle h ); +char *pnd_pxml_get_associationitem3_filetype ( pnd_pxml_handle h ); +char *pnd_pxml_get_associationitem3_parameter ( pnd_pxml_handle h ); char *pnd_pxml_get_clockspeed ( pnd_pxml_handle h ); +char *pnd_pxml_get_background ( pnd_pxml_handle h ); +char *pnd_pxml_get_startdir ( pnd_pxml_handle h ); // for 'set' functions, pass NULL value to delete existing value without setting new one void pnd_pxml_set_app_name ( pnd_pxml_handle h, char *v ); diff --git a/lib/pnd_discovery.c b/lib/pnd_discovery.c index 9513087..860af1f 100644 --- a/lib/pnd_discovery.c +++ b/lib/pnd_discovery.c @@ -131,21 +131,21 @@ static int pnd_disco_callback ( const char *fpath, const struct stat *sb, pnd_disco_t *p; p = pnd_box_allocinsert ( disco_box, (char*) fpath, sizeof(pnd_disco_t) ); - if ( pnd_pxml_get_app_name ( pxmlh ) ) { - p -> title_en = strdup ( pnd_pxml_get_app_name ( pxmlh ) ); + if ( pnd_pxml_get_app_name_en ( pxmlh ) ) { + p -> title_en = strdup ( pnd_pxml_get_app_name_en ( pxmlh ) ); } - if ( pnd_pxml_get_icon_path ( pxmlh ) ) { - p -> icon = strdup ( pnd_pxml_get_icon_path ( pxmlh ) ); + if ( pnd_pxml_get_icon ( pxmlh ) ) { + p -> icon = strdup ( pnd_pxml_get_icon ( pxmlh ) ); } - if ( pnd_pxml_get_exec_path ( pxmlh ) ) { - snprintf ( b, 1024, "pnd_run_magic %s", pnd_pxml_get_exec_path ( pxmlh ) ); + if ( pnd_pxml_get_exec ( pxmlh ) ) { + snprintf ( b, 1024, "pnd_run_magic %s", pnd_pxml_get_exec ( pxmlh ) ); p -> exec = strdup ( b ); } if ( pnd_pxml_get_unique_id ( pxmlh ) ) { p -> unique_id = strdup ( pnd_pxml_get_unique_id ( pxmlh ) ); } - if ( pnd_pxml_get_primary_category ( pxmlh ) ) { - p -> main_category = strdup ( pnd_pxml_get_primary_category ( pxmlh ) ); + if ( pnd_pxml_get_main_category ( pxmlh ) ) { + p -> main_category = strdup ( pnd_pxml_get_main_category ( pxmlh ) ); } if ( pnd_pxml_get_clockspeed ( pxmlh ) ) { p -> clockspeed = strdup ( pnd_pxml_get_clockspeed ( pxmlh ) ); diff --git a/lib/pnd_pxml.c b/lib/pnd_pxml.c index ab134ef..35b21b3 100644 --- a/lib/pnd_pxml.c +++ b/lib/pnd_pxml.c @@ -43,42 +43,133 @@ void pnd_pxml_delete ( pnd_pxml_handle h ) { if ( p -> title_en ) { free ( p -> title_en ); } - + if ( p -> title_de ) { + free ( p -> title_de ); + } + if ( p -> title_it ) { + free ( p -> title_it ); + } + if ( p -> title_fr ) { + free ( p -> title_fr ); + } + if ( p -> unique_id ) { + free ( p -> unique_id ); + } + if ( p -> standalone ) { + free ( p -> standalone ); + } if ( p -> icon ) { free ( p -> icon ); } - + if ( p -> description_en ) { + free ( p -> description_en ); + } + if ( p -> description_de ) { + free ( p -> description_de ); + } + if ( p -> description_it ) { + free ( p -> description_it ); + } + if ( p -> description_fr ) { + free ( p -> description_fr ); + } + if ( p -> previewpic1 ) { + free ( p -> previewpic1 ); + } + if ( p -> previewpic2 ) { + free ( p -> previewpic2 ); + } + if ( p -> author_name ) { + free ( p -> author_name ); + } + if ( p -> author_website ) { + free ( p -> author_website ); + } + if ( p -> version_major ) { + free ( p -> version_major ); + } + if ( p -> version_minor ) { + free ( p -> version_minor ); + } + if ( p -> version_release ) { + free ( p -> version_release ); + } + if ( p -> version_build ) { + free ( p -> version_build ); + } if ( p -> exec ) { free ( p -> exec ); } if ( p -> main_category ) { free ( p -> main_category ); } - if ( p -> unique_id ) { - free ( p -> unique_id ); + if ( p -> subcategory1 ) { + free ( p -> subcategory1 ); + } + if ( p -> subcategory2 ) { + free ( p -> subcategory2 ); + } + if ( p -> altcategory ) { + free ( p -> altcategory ); + } + if ( p -> altsubcategory1 ) { + free ( p -> altsubcategory1 ); + } + if ( p -> altsubcategory2 ) { + free ( p -> altsubcategory2 ); + } + if ( p -> osversion_major ) { + free ( p -> osversion_major ); + } + if ( p -> osversion_minor ) { + free ( p -> osversion_minor ); + } + if ( p -> osversion_release ) { + free ( p -> osversion_release ); + } + if ( p -> osversion_build ) { + free ( p -> osversion_build ); + } + if ( p -> associationitem1_name ) { + free ( p -> associationitem1_name ); + } + if ( p -> associationitem1_filetype ) { + free ( p -> associationitem1_filetype ); + } + if ( p -> associationitem1_parameter ) { + free ( p -> associationitem1_parameter ); + } + if ( p -> associationitem2_name ) { + free ( p -> associationitem2_name ); + } + if ( p -> associationitem2_filetype ) { + free ( p -> associationitem2_filetype ); + } + if ( p -> associationitem2_parameter ) { + free ( p -> associationitem2_parameter ); + } + if ( p -> associationitem3_name ) { + free ( p -> associationitem3_name ); + } + if ( p -> associationitem1_filetype ) { + free ( p -> associationitem3_filetype ); + } + if ( p -> associationitem1_parameter ) { + free ( p -> associationitem3_parameter ); } if ( p -> clockspeed ) { free ( p -> clockspeed ); } + if ( p -> background ) { + free ( p -> background ); + } + if ( p -> startdir ) { + free ( p -> startdir ); + } return; } -char *pnd_pxml_get_app_name ( pnd_pxml_handle h ) { - pnd_pxml_t *p = (pnd_pxml_t*) h; - return ( p -> title_en ); -} - -char *pnd_pxml_get_icon_path ( pnd_pxml_handle h ) { - pnd_pxml_t *p = (pnd_pxml_t*) h; - return ( p -> icon ); -} - -char *pnd_pxml_get_clockspeed ( pnd_pxml_handle h ) { - pnd_pxml_t *p = (pnd_pxml_t*) h; - return ( p -> clockspeed ); -} - void pnd_pxml_set_app_name ( pnd_pxml_handle h, char *v ) { pnd_pxml_t *p = (pnd_pxml_t*) h; if ( p -> title_en ) { @@ -93,21 +184,6 @@ void pnd_pxml_set_app_name ( pnd_pxml_handle h, char *v ) { return; } -char *pnd_pxml_get_unique_id ( pnd_pxml_handle h ) { - pnd_pxml_t *p = (pnd_pxml_t*) h; - return ( p -> unique_id ); -} - -char *pnd_pxml_get_primary_category ( pnd_pxml_handle h ) { - pnd_pxml_t *p = (pnd_pxml_t*) h; - return ( p -> main_category ); -} - -char *pnd_pxml_get_exec_path ( pnd_pxml_handle h ) { - pnd_pxml_t *p = (pnd_pxml_t*) h; - return ( p -> exec ); -} - unsigned char pnd_is_pxml_valid_app ( pnd_pxml_handle h ) { pnd_pxml_t *p = (pnd_pxml_t*) h; @@ -148,8 +224,8 @@ signed char pnd_pxml_merge_override ( pnd_pxml_handle h, char *searchpath ) { if ( mergeh ) { - if ( pnd_pxml_get_app_name ( mergeh ) ) { - pnd_pxml_set_app_name ( h, pnd_pxml_get_app_name ( mergeh ) ); + if ( pnd_pxml_get_app_name_en ( mergeh ) ) { + pnd_pxml_set_app_name ( h, pnd_pxml_get_app_name_en ( mergeh ) ); } pnd_pxml_delete ( mergeh ); @@ -160,3 +236,213 @@ signed char pnd_pxml_merge_override ( pnd_pxml_handle h, char *searchpath ) { return ( retval ); } + +char *pnd_pxml_get_app_name_en ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> title_en ); +} + +char *pnd_pxml_get_app_name_de ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> title_de ); +} + +char *pnd_pxml_get_app_name_it ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> title_it ); +} + +char *pnd_pxml_get_app_name_fr ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> title_fr ); +} + +char *pnd_pxml_get_unique_id ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> unique_id ); +} + +char *pnd_pxml_get_standalone ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> standalone ); +} + +char *pnd_pxml_get_icon ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> icon ); +} + +char *pnd_pxml_get_description_en ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> description_en ); +} + +char *pnd_pxml_get_description_de ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> description_de ); +} + +char *pnd_pxml_get_description_it ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> description_it ); +} + +char *pnd_pxml_get_description_fr ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> description_fr ); +} + +char *pnd_pxml_get_previewpic1 ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> previewpic1 ); +} + +char *pnd_pxml_get_previewpic2 ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> previewpic2 ); +} + +char *pnd_pxml_get_author_name ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> author_name ); +} + +char *pnd_pxml_get_author_website ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> author_website ); +} + +char *pnd_pxml_get_version_major ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> version_major ); +} + +char *pnd_pxml_get_version_minor ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> version_minor ); +} + +char *pnd_pxml_get_version_release ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> version_release ); +} + +char *pnd_pxml_get_version_build ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> version_build ); +} + +char *pnd_pxml_get_exec ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> exec ); +} + +char *pnd_pxml_get_main_category ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> main_category ); +} + +char *pnd_pxml_get_subcategory1 ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> subcategory1 ); +} + +char *pnd_pxml_get_subcategory2 ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> subcategory2 ); +} + +char *pnd_pxml_get_altcategory ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> altcategory ); +} + +char *pnd_pxml_get_altsubcategory1 ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> altsubcategory1 ); +} + +char *pnd_pxml_get_altsubcategory2 ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> altsubcategory2 ); +} + +char *pnd_pxml_get_osversion_major ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> osversion_major ); +} + +char *pnd_pxml_get_osversion_minor ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> osversion_minor ); +} + +char *pnd_pxml_get_osversion_release ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> osversion_release ); +} + +char *pnd_pxml_get_osversion_build ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> osversion_build ); +} + +char *pnd_pxml_get_associationitem1_name ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> associationitem1_name ); +} + +char *pnd_pxml_get_associationitem1_filetype ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> associationitem1_filetype ); +} + +char *pnd_pxml_get_associationitem1_parameter ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> associationitem1_parameter ); +} + +char *pnd_pxml_get_associationitem2_name ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> associationitem2_name ); +} + +char *pnd_pxml_get_associationitem2_filetype ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> associationitem2_filetype ); +} + +char *pnd_pxml_get_associationitem2_parameter ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> associationitem2_parameter ); +} + +char *pnd_pxml_get_associationitem3_name ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> associationitem3_name ); +} + +char *pnd_pxml_get_associationitem3_filetype ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> associationitem3_filetype ); +} + +char *pnd_pxml_get_associationitem3_parameter ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> associationitem3_parameter ); +} + +char *pnd_pxml_get_clockspeed ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> clockspeed ); +} + +char *pnd_pxml_get_background ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> background ); +} + +char *pnd_pxml_get_startdir ( pnd_pxml_handle h ) { + pnd_pxml_t *p = (pnd_pxml_t*) h; + return ( p -> startdir ); +} -- 2.39.2