feat: system settings stored as applets in virtual folder
This commit is contained in:
1 parent
de96c1ca57
commit
be67fce29a
21 files changed
+747
-359
No files matched your search
@@ -8,6 +8,17 @@
|
||||
|
||||
namespace filemanager {
|
||||
|
||||
static bool filemanager_open_virtual_path(FileManagerState* fm, const char* path) {
|
||||
if (!fm || !path) return false;
|
||||
|
||||
if (montauk::streq(path, FILEMANAGER_PATH_SYSTEM_CONFIGURATION)) {
|
||||
filemanager_read_virtual_view(fm, FM_VIRTUAL_VIEW_SYSTEM_TOOLS);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void open_filemanager_internal(DesktopState* ds, const char* initial_path) {
|
||||
int idx = desktop_create_window(ds, "Files", 150, 120, 560, 420);
|
||||
if (idx < 0) return;
|
||||
@@ -27,13 +38,17 @@ static void open_filemanager_internal(DesktopState* ds, const char* initial_path
|
||||
ensure_filemanager_icons_loaded(ds);
|
||||
|
||||
if (initial_path && initial_path[0] != '\0') {
|
||||
int probe_fd = montauk::open(initial_path);
|
||||
if (probe_fd >= 0) {
|
||||
montauk::close(probe_fd);
|
||||
montauk::strncpy(fm->current_path, initial_path, sizeof(fm->current_path));
|
||||
filemanager_read_dir(fm);
|
||||
if (filemanager_open_virtual_path(fm, initial_path)) {
|
||||
// Virtual view already loaded.
|
||||
} else {
|
||||
filemanager_read_drives(fm);
|
||||
int probe_fd = montauk::open(initial_path);
|
||||
if (probe_fd >= 0) {
|
||||
montauk::close(probe_fd);
|
||||
montauk::strncpy(fm->current_path, initial_path, sizeof(fm->current_path));
|
||||
filemanager_read_dir(fm);
|
||||
} else {
|
||||
filemanager_read_drives(fm);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
filemanager_read_drives(fm);
|
||||
@@ -59,6 +74,9 @@ void ensure_filemanager_icons_loaded(DesktopState* ds) {
|
||||
ds->icon_home_folder_lg = svg_load("0:/icons/folder-blue-home.svg", 48, 48, defColor);
|
||||
ds->icon_apps = svg_load("0:/icons/folder-blue-development.svg", 16, 16, defColor);
|
||||
ds->icon_apps_lg = svg_load("0:/icons/folder-blue-development.svg", 48, 48, defColor);
|
||||
ds->icon_system_tools_menu = svg_load("0:/icons/preferences-system.svg", 20, 20, defColor);
|
||||
ds->icon_system_tools = svg_load("0:/icons/preferences-system.svg", 16, 16, defColor);
|
||||
ds->icon_system_tools_lg = svg_load("0:/icons/preferences-system.svg", 48, 48, defColor);
|
||||
|
||||
for (int sf = 0; sf < filemanager::SF_COUNT; sf++) {
|
||||
char icon_path[128];
|
||||
|
||||
Reference in new issue
Block a user