class FPFolderButton {
public:
GtkBuilder *builder;// unref by UnrefBuilder();
bool ChildLoaded = false;
// To save memory, child files and folders will only be loaded when the Content got expanded for the first time.
bool Inited = false;
char *FolderName;
GtkBox *BaseBox;// Containing FolderToggleBut and Content
GtkButton *FolderToggleBut;
GtkBox *Content;// Containing child files and child folders
GFile *Folder;// Corresponding GFile
int Level;// Root folder is 0
bool IsOpen=false;
void init(GFile &folder,GFile *parentfolder,int level);
void AddChildFolder(FPFolderButton& Child);
void AddChildFile(FPFileButton& Child);
void UnrefBuilder();
};
Use init to apply properties in the class.
GtkButton *FolderToggleBut
is the button you click to expand the GtkBox *Content
in file panel. If the button is clicked, ToggleFolder()
(the function is not in the class) will be called, and expand Content
.
To reduce memory usage, FPFolderButton
will not load all of its child when you have selected a folder from the headerbar. It will only load children when you first expend the content.