|
@@ -252,6 +252,7 @@ void la_FileBrowserRebuildList(laFileBrowser *fb){
|
|
|
for(int i=0;i<NumFiles;i++){
|
|
|
struct dirent* d = NameList[i];
|
|
|
if(!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")){continue;}
|
|
|
+ if(fb->FilterName[0] && !strcasestr(d->d_name,fb->FilterName)){continue;}
|
|
|
struct stat s;
|
|
|
sprintf(Final, "%s%s",fb->Path,d->d_name);
|
|
|
stat(Final, &s);
|
|
@@ -298,6 +299,7 @@ void la_FileBrowserRebuildList(laFileBrowser *fb){
|
|
|
if (hFind == INVALID_HANDLE_VALUE){ return; }
|
|
|
|
|
|
while (1) {
|
|
|
+ if(fb->FilterName[0] && !strcasestr(FindFileData.cFileName,fb->FilterName)){goto findnext;}
|
|
|
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
|
|
if (FindFileData.cFileName[0] != '.') {
|
|
|
fi = memAcquireSimple(sizeof(laFileItem));
|
|
@@ -326,6 +328,7 @@ void la_FileBrowserRebuildList(laFileBrowser *fb){
|
|
|
lstAppendItem(&Files, fi);
|
|
|
//lstAppendItem(&fb->FileList, fi);
|
|
|
}
|
|
|
+findnext:
|
|
|
if (!FindNextFile(hFind, &FindFileData))
|
|
|
break;
|
|
|
}
|
|
@@ -425,7 +428,7 @@ void laset_FileBrowserSelectFile(laFileBrowser *fb, laFileItem *fi, int State){
|
|
|
if (fb->Path[len - 1] != LA_PATH_SEP) strcat(fb->Path, LA_PATH_SEPSTR);
|
|
|
strcat(fb->Path, fi->Name);
|
|
|
la_FileBrowserRebuildList(fb);
|
|
|
- fb->FileName[0] = 0;
|
|
|
+ fb->FileName[0] = 0; fb->FilterName[0]=0;
|
|
|
laRecalcCurrentPanelImmediate();
|
|
|
}
|
|
|
}else{
|
|
@@ -482,6 +485,10 @@ void laset_FileBrowserFileName(laFileBrowser *fb, char *content){
|
|
|
la_FileBrowserRebuildList(fb);
|
|
|
laRecalcCurrentPanel();
|
|
|
}
|
|
|
+void laset_FileBrowserFilterName(laFileBrowser *fb, char *content){
|
|
|
+ strCopyFull(fb->FilterName, content); int file_okay=0;
|
|
|
+ la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
|
|
|
+}
|
|
|
void* laget_FileBrowserAcceptedExtensionsFrist(laFileBrowser* fb, laPropIterator* pi){
|
|
|
if(!fb->UseType){ return 0; }
|
|
|
for(laExtensionType*et=MAIN.ExtraExtensions.pFirst;et;et=et->Item.pNext){
|
|
@@ -2410,6 +2417,7 @@ void la_RegisterBuiltinOperators(){
|
|
|
laAddStringProperty(pc, "path", "Path", "Directort path", 0, 0, 0, "/", 0, offsetof(laFileBrowser, Path), 0, 0, laset_FileBrowserPath, 0, LA_UDF_LOCAL);
|
|
|
laAddStringProperty(pc, "file_name", "File Name", "File name", 0, 0, 0, 0, 0, offsetof(laFileBrowser, FileName), 0, 0, laset_FileBrowserFileName, 0, LA_UDF_LOCAL);
|
|
|
laAddStringProperty(pc, "temp_str", "Temp String", "Temp string", 0, 0, 0, "", 0, offsetof(laFileBrowser, TempStr), 0, 0, 0, 0, LA_UDF_LOCAL);
|
|
|
+ laAddStringProperty(pc, "filter_name", "Filter Name", "Filter file name", 0, 0, 0, 0, 0, offsetof(laFileBrowser, FilterName), 0, 0, laset_FileBrowserFilterName, 0, LA_UDF_LOCAL);
|
|
|
laAddSubGroup(pc, "file_list", "File List", "List Of Files And Directories Under A Specific Path", "file_item",0,0,laui_FileBrowserFileItem, -1, 0, laget_FileBrowserActiveFile, 0, 0, 0, laset_FileBrowserSelectFile, offsetof(laFileBrowser, FileList), 0);
|
|
|
laAddSubGroup(pc, "disk_list", "Disk List", "List Of All Logical Drives (In Windows)", "disk_item",0, 0, 0, -1, 0, 0, 0, 0, 0, laset_FileBrowserActiveDisk, offsetof(laFileBrowser, Disks), 0);
|
|
|
laAddSubGroup(pc, "bookmarks", "Bookmarks", "Bookmarked directories in GTK3", "bookmarked_folder",0, 0, 0, -1, 0, 0, 0, laset_FileBrowserBookmark, 0, 0, offsetof(laFileBrowser, Bookmarks), 0);
|