X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=minimenu%2Fmmcustom_cats.c;h=1cc5c65f93548d4f44873dae37be02b7d9ee5106;hb=3060a2d67e9b7b9df2ae858a84f2d8bcd1ab6906;hp=445a81dd27c016ee616534a74a66e4fdf6de36e9;hpb=0eb323ec50e38d8728718aea1a8551fe4fdb9a44;p=pandora-libraries.git diff --git a/minimenu/mmcustom_cats.c b/minimenu/mmcustom_cats.c index 445a81d..1cc5c65 100644 --- a/minimenu/mmcustom_cats.c +++ b/minimenu/mmcustom_cats.c @@ -1,7 +1,7 @@ +#define __USE_GNU /* for strndup */ #include #include /* for PATH_MAX */ -#define __USE_GNU /* for strndup */ #include /* for strdup */ #include /* getenv */ @@ -145,6 +145,25 @@ mmcustom_cat_t *mmcustom_query ( char *name, char *parentcatname ) { return ( NULL ); } +unsigned int mmcustom_subcount ( char *parentcatname ) { + unsigned int counter = 0; + + int i; + + // search for the cat/parent combination + for ( i = 0; i < mmcustom_count; i++ ) { + + if ( mmcustom_complete [ i ].parent_cat && + strcmp ( mmcustom_complete [ i ].parent_cat, parentcatname ) == 0 ) + { + counter++; + } + + } // for + + return ( counter ); +} + mmcustom_cat_t *mmcustom_register ( char *catname, char *parentcatname ) { mmcustom_complete [ mmcustom_count ].cat = strdup ( catname ); if ( parentcatname ) { @@ -219,10 +238,10 @@ void mmcustom_unregister ( char *catname, char *parentcatname ) { } // for // kill the actual cat itself - if ( i >= 0 ) { + if ( parent_index >= 0 ) { pnd_log ( pndn_warning, " Removing cat: %s\n", catname ); - free ( mmcustom_complete [ i ].cat ); - mmcustom_complete [ i ].cat = NULL; + free ( mmcustom_complete [ parent_index ].cat ); + mmcustom_complete [ parent_index ].cat = NULL; } return;