SRC += filebrowser.c
SRC += gtk-filesview.c
SRC += bookmarks.c
+SRC += files.c
SRC += $(MZUI)
};
struct FileInfo {
- char *parent;
+ const char *parent;
char *name;
size_t size;
time_t mtime;
if(op->result) {
int view = ui_get(op->browser->view);
if(view == 0 && op->browser->update_grid) {
- // TODO: group feature
- // for now, just create a single section and move the result list
FilesSection *section = malloc(sizeof(FilesSection));
memset(section, 0, sizeof(FilesSection));
section->files = op->result;
--- /dev/null
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2025 Olaf Wintermann. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "files.h"
+
+void files_section_free(FilesSection *s, size_t nsections) {
+ if(!s) {
+ return;
+ }
+
+ for(size_t i=0;i<nsections;i++) {
+ CxIterator iter = cxListIterator(s->files);
+ cx_foreach(FileInfo *, file, iter) {
+ free(file->name);
+ }
+ free(s->parent_url);
+ }
+ free(s);
+}
--- /dev/null
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2025 Olaf Wintermann. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MZ_FILES_H
+#define MZ_FILES_H
+
+#include "application.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void files_section_free(FilesSection *s, size_t nsections);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MZ_FILES_H */
+
*/
#include "gtk-filesview.h"
+#include "files.h"
#include <sys/stat.h>
#include <sys/types.h>
free(view->items);
+ files_section_free(view->filessections, view->num_filessections);
+ view->filessections = sections;
+ view->num_filessections = numsections;
+
view->sections = calloc(numsections, sizeof(MzFilesView));
size_t nchildren = 0;
for(size_t i=0;i<numsections;i++) {
void (*open)(FileInfo **files, size_t numfiles, void *userdata);
void *open_userdata;
+ FilesSection *filessections;
+ size_t num_filessections;
+
MzIconGadget *items;
size_t numitems;