Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
file_manager.h
1// SPDX-FileCopyrightText: © 2019-2023 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#ifndef __GUI_BACKEND_FILE_MANAGER_H__
5#define __GUI_BACKEND_FILE_MANAGER_H__
6
7#include "gtk_wrapper.h"
8
9typedef struct SupportedFile SupportedFile;
10
21{
22 FILE_MANAGER_NONE,
23 FILE_MANAGER_HOME,
24 FILE_MANAGER_DESKTOP,
25 FILE_MANAGER_DRIVE,
26};
27
28#define FILE_MANAGER (gZrythm->file_manager)
29
53
58{
59 FB_SELECTION_TYPE_COLLECTIONS,
60 FB_SELECTION_TYPE_LOCATIONS,
61};
62
63typedef struct FileManager
64{
74 GPtrArray * files;
75
76#if 0
80 char * collections[50];
81 int num_collections;
82#endif
83
89 GPtrArray * locations;
90
95
97
103
107void
109
114NONNULL void
116 FileManager * self,
118 bool load_files,
119 bool save_to_settings);
120
124void
126
128file_browser_location_new (void);
129
130static inline const char *
131file_browser_location_get_icon_name (const FileBrowserLocation * loc)
132{
133 switch (loc->special_location)
134 {
135 case FileManagerSpecialLocation::FILE_MANAGER_NONE:
136 return "folder";
137 case FileManagerSpecialLocation::FILE_MANAGER_HOME:
138 return "user-home";
139 case FileManagerSpecialLocation::FILE_MANAGER_DESKTOP:
140 return "desktop";
141 case FileManagerSpecialLocation::FILE_MANAGER_DRIVE:
142 return "drive-harddisk-symbolic";
143 }
144 return "folder";
145}
146
148file_browser_location_clone (FileBrowserLocation * loc);
149
150void
151file_browser_location_print (const FileBrowserLocation * loc);
152
156void
157file_manager_add_location_and_save (FileManager * self, const char * abs_path);
158
166void
168 FileManager * self,
169 const char * location,
170 bool skip_if_standard);
171
172GMenuModel *
173file_browser_location_generate_context_menu (const FileBrowserLocation * self);
174
175NONNULL void
176file_browser_location_free (FileBrowserLocation * loc);
177
182#endif
void file_manager_add_location_and_save(FileManager *self, const char *abs_path)
Adds a location and saves the settings.
FileManagerSpecialLocation
Special location type.
void file_manager_free(FileManager *self)
Frees the file manager.
void file_manager_load_files(FileManager *self)
Loads the files under the current selection.
void file_manager_remove_location_and_save(FileManager *self, const char *location, bool skip_if_standard)
Removes the given location (bookmark) from the saved locations.
FileBrowserSelectionType
Current selection in the top window.
NONNULL void file_manager_set_selection(FileManager *self, FileBrowserLocation *sel, bool load_files, bool save_to_settings)
FileManager * file_manager_new(void)
Creates the file manager.
Locations to be used in the file browser.
char * path
Absolute path.
char * label
Human readable label.
FileManagerSpecialLocation special_location
Whether this is a standard (undeletable) location.
GPtrArray * locations
Default locations & user defined locations.
GPtrArray * files
Descriptors for files under the current collection / location.
FileBrowserLocation * selection
Current selection in the top window.
Metadata for a supported file.