Indicate if no results are found for a query.

This commit is contained in:
Stephen Heumann 2019-04-19 21:37:58 -05:00
parent 716df24211
commit d615b32431
4 changed files with 19 additions and 5 deletions

View File

@ -46,6 +46,9 @@ Word myUserID;
/* String for "More Results" (used to identify that list entry) */
char moreResultsString[] = " <More Results>";
/* String to indicate no results were found */
char noResultsString[] = " No Disks Found";
/***/
static char menuTitle[] = "\pArchive.org Disk Browser\xC9";

View File

@ -46,6 +46,9 @@ extern struct diskListEntry *diskList;
/* String for "More Results" (used to identify that list entry) */
extern char moreResultsString[];
/* String to indicate no results were found */
extern char noResultsString[];
/* Do we want to open a window with disk contents? Counts down until ready. */
extern int wantToOpenWindow;

View File

@ -42,15 +42,18 @@ void DoMount(void) {
enum NetDiskError result = 0;
json_value *filesJSON = NULL;
WaitCursor();
if (itemNumber == 0) {
// shouldn't happen
result = 1;
goto errorReturn;
return;
}
itemNumber--;
if (diskList[itemNumber].memPtr == noResultsString) {
return;
}
WaitCursor();
if (diskList[itemNumber].memPtr == moreResultsString) {
DoSearch(true);
return;

View File

@ -40,6 +40,7 @@ static boolean processDoc(json_value *docObj);
static char *EncodeQueryString(char *queryString);
struct diskListEntry moreResultsEntry = {moreResultsString , 0, "", ""};
struct diskListEntry noResultsEntry = {noResultsString , 0x60, "", ""};
static void InsertDiskListEntry(struct diskListEntry *entry);
@ -154,6 +155,10 @@ void DoSearch(boolean getMore) {
MakeThisCtlTarget(disksListHandle);
CallCtlDefProc(disksListHandle, ctlChangeTarget, 0);
}
} else {
InsertDiskListEntry(&noResultsEntry);
NewList2(NULL, 1, (Ref) diskList, refIsPointer,
diskListLength, (Handle)disksListHandle);
}
free(searchURL);