X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=minimenu%2Fmmcache.c;h=691a2ccb51b4b49c1e360de3b967bac635e5b0af;hb=be8d9dd80391cde8e8877550004ff23b76ab87d5;hp=bc98c68c9096af80be5c54f523a31f963bc46094;hpb=4aefc132224a6a4d9554a0cf151a3c5bfa8380df;p=pandora-libraries.git diff --git a/minimenu/mmcache.c b/minimenu/mmcache.c index bc98c68..691a2cc 100644 --- a/minimenu/mmcache.c +++ b/minimenu/mmcache.c @@ -103,16 +103,23 @@ unsigned char cache_preview ( pnd_disco_t *app, unsigned int maxwidth, unsigned } } + // unique-id to use for the cache mount + char *uid = app -> unique_id; + + if ( app -> appdata_dirname ) { + uid = app -> appdata_dirname; + } + // if we don't have a file path sorted out yet, means we need to mount and figure it if ( ! filepath [ 0 ] ) { sprintf ( fullpath, "%s/%s", app -> object_path, app -> object_filename ); - if ( ! pnd_pnd_mount ( pnd_run_script, fullpath, app -> unique_id ) ) { + if ( ! pnd_pnd_mount ( pnd_run_script, fullpath, uid ) ) { pnd_log ( pndn_debug, "Couldn't mount '%s' for preview\n", fullpath ); return ( 0 ); // couldn't mount?! } - sprintf ( filepath, "%s/%s/%s", PND_MOUNT_PATH, app -> unique_id, app -> preview_pic1 ); + sprintf ( filepath, "%s/%s/%s", PND_MOUNT_PATH, uid, app -> preview_pic1 ); } // load whatever path we've got @@ -121,7 +128,7 @@ unsigned char cache_preview ( pnd_disco_t *app, unsigned int maxwidth, unsigned if ( ! s ) { // unmount it, if mounted if ( fullpath [ 0 ] ) { - pnd_pnd_unmount ( pnd_run_script, fullpath, app -> unique_id ); + pnd_pnd_unmount ( pnd_run_script, fullpath, uid ); } pnd_log ( pndn_debug, "Couldn't open image '%s' for preview\n", filepath ); return ( 0 ); @@ -240,29 +247,31 @@ unsigned char cache_icon ( pnd_disco_t *app, unsigned char maxwidth, unsigned ch } // ovr? // if this is a real pnd file (dir-app or pnd-file-app), then try to pull icon from there - if ( app -> object_flags & PND_DISCO_GENERATED ) { + if ( ! iconbuf ) { - // maybe we can discover this single-file and find an icon? - if ( strcasestr ( app -> object_filename, PND_PACKAGE_FILEEXT ) ) { + if ( app -> object_flags & PND_DISCO_GENERATED ) { - // looks like a pnd, now what do we do.. - pnd_box_handle h = pnd_disco_file ( app -> object_path, app -> object_filename ); + // maybe we can discover this single-file and find an icon? + if ( strcasestr ( app -> object_filename, PND_PACKAGE_FILEEXT ) ) { - if ( h ) { - pnd_disco_t *d = pnd_box_get_head ( h ); - iconbuf = pnd_emit_icon_to_buffer ( d, &buflen ); - } + // looks like a pnd, now what do we do.. + pnd_box_handle h = pnd_disco_file ( app -> object_path, app -> object_filename ); - } // filename has .pnd? + if ( h ) { + pnd_disco_t *d = pnd_box_get_head ( h ); + iconbuf = pnd_emit_icon_to_buffer ( d, &buflen ); + } - } else { + } // filename has .pnd? + + } else { - // pull icon into buffer from .pnd if not already found an icon - if ( ! iconbuf ) { + // pull icon into buffer from .pnd if not already found an icon iconbuf = pnd_emit_icon_to_buffer ( app, &buflen ); - } - } // generated? + } // generated? + + } // already got icon? if ( ! iconbuf ) { return ( 0 );