2eb4c6d91873ad7c8f68f8e2e419e3382d46a16f tdreszer Thu Oct 20 17:37:48 2011 -0700 Added file list caching to hgFileUi and extended the filterBox logic to include non-multiSelect options. Redmine 5527 for the fileBoxes. diff --git src/hg/lib/mdb.c src/hg/lib/mdb.c index 23f5981..4cf73be 100644 --- src/hg/lib/mdb.c +++ src/hg/lib/mdb.c @@ -1843,41 +1843,50 @@ char *mdbObjFindValue(struct mdbObj *mdbObj, char *var) // Finds the val associated with the var or retruns NULL { struct mdbVar *mdbVar = mdbObjFind(mdbObj, var); if(mdbVar == NULL) { if (sameWord(var,"obj") || sameWord(var,"objName") || sameWord(var,"metaObject")) return mdbObj->obj; return NULL; } return mdbVar->val; } -struct slName *mdbObjsFindAllVals(struct mdbObj *mdbObjs, char *var) +struct slName *mdbObjsFindAllVals(struct mdbObj *mdbObjs, char *var, char *emptyToken) // Returns a list of all vals in mdbObjs for a requested var +// Will add empty only if there is atleast one empty val and at least one val found { struct slName *vals = NULL; struct mdbObj *mdbObj = mdbObjs; +boolean foundEmpty = FALSE; for (;mdbObj != NULL;mdbObj = mdbObj->next) { char *val = mdbObjFindValue(mdbObj,var); if (val != NULL) slNameStore(&vals, val); + else + foundEmpty = TRUE; } + +// Will add empty only if there is atleast one empty val and at least one val found +if (foundEmpty && vals != NULL && (emptyToken != NULL)) + slNameStore(&vals, emptyToken); + return vals; } boolean mdbObjContains(struct mdbObj *mdbObj, char *var, char *val) // Returns TRUE if object contains var, val or both { if (mdbObj == NULL) return FALSE; if(var != NULL) { char *foundVal = mdbObjFindValue(mdbObj,var); if(foundVal == NULL) return FALSE; if(val == NULL)