Page MenuHome

UI: Mac File Browser System List Changes
Needs ReviewPublic

Authored by Yevgeny Makarov (jenkm) on Dec 11 2019, 6:30 PM.

Diff Detail

Repository
rB Blender

Event Timeline

William Reynish (billreynish) requested changes to this revision.Dec 12 2019, 3:36 AM

Thanks for looking at this.

The good news:

  • It compiles! :)
  • The icons are showing!

Bad news:

  • The System source list is broken now. It doesn't get the correct folders from the Finder Sidebar.
  • Clicking on the directories in the System category doesn't work
  • It only shows icons in the System panel. The same folders in Recents and Bookmarks panels don't have icons.

It seems to me that this patch is trying to change too many things. Really we should not have to change the way we get the folders from the Finder Sidebar (which was working fine) but simply add the correct icons to the correct paths.

This revision now requires changes to proceed.Dec 12 2019, 3:36 AM

Abandoning this patch. Had made assumptions based on a report from someone else that is incorrect.

Just a little mistake here, you need replace "~" with the user home dir BLI_getenv("HOME").

@Yevgeny Makarov (jenkm) Maybe it makes sense if you can take over this revision fully? Since @Harley Acheson (harley) doesn't have a Mac to build and test on, it may be better if you can commander this?

@Yevgeny Makarov (jenkm) Maybe it makes sense if you can take over this revision fully? Since @Harley Acheson (harley) doesn't have a Mac to build and test on, it may be better if you can commander this?

That would be awesome! I don’t have a Mac to compile or test with so this was done completely blind.

Whoops! No, please don’t use this patch.

This particular one was abandoned because it was explicitly adding entries to the list, when I was under the assumption that there was only a small number of predictable items.

We have since decided to use the list of system-supplied special folders and assign icons based on substrings (these path names are not localized). I’m not sure my latest Mac-specific patch is on the tracker right now. Was shared with William for testing and with Campbell. I’ll sort these out and try to get all platforms in shortly after I get back in about eight days. There is some shared code and then small changes per each platform.

The shared things, along with the Windows-specific stuff is here: https://developer.blender.org/D6405 and would be first step.

I tried to add a new FSMenuCategory for storing known paths and modified fsmenu_insert_entry so it would always look for icons/names in this "known paths" category. It seems this way works well.

I don't know how to do it correctly, so I don't share the code, but here is the code with Mac paths:

const char *home = BLI_getenv("HOME");
char line[FILE_MAXDIR];

BLI_snprintf(line, sizeof(line), "%s/", home);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_KNOWN_PATHS, line, NULL, ICON_HOME, FS_INSERT_LAST);

BLI_snprintf(line, sizeof(line), "%s/Desktop/", home);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_KNOWN_PATHS, line, IFACE_("Desktop"), ICON_DESKTOP, FS_INSERT_LAST);

BLI_snprintf(line, sizeof(line), "%s/Documents/", home);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_KNOWN_PATHS, line, IFACE_("Documents"), ICON_DOCUMENTS, FS_INSERT_LAST);

BLI_snprintf(line, sizeof(line), "%s/Downloads/", home);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_KNOWN_PATHS, line, IFACE_("Downloads"), ICON_IMPORT, FS_INSERT_LAST);

BLI_snprintf(line, sizeof(line), "%s/Movies/", home);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_KNOWN_PATHS, line, IFACE_("Movies"), ICON_FILE_MOVIE, FS_INSERT_LAST);

BLI_snprintf(line, sizeof(line), "%s/Music/", home);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_KNOWN_PATHS, line, IFACE_("Music"), ICON_FILE_SOUND, FS_INSERT_LAST);

BLI_snprintf(line, sizeof(line), "%s/Pictures/", home);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_KNOWN_PATHS, line, IFACE_("Pictures"), ICON_FILE_IMAGE, FS_INSERT_LAST);

BLI_snprintf(line, sizeof(line), "%s/Library/Fonts/", home);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_KNOWN_PATHS, line, IFACE_("Fonts"), ICON_FILE_FONT, FS_INSERT_LAST);

fsmenu_insert_entry(fsmenu, FS_CATEGORY_KNOWN_PATHS, "/Library/Fonts/", IFACE_("Fonts"), ICON_FILE_FONT, FS_INSERT_LAST);

fsmenu_insert_entry(fsmenu, FS_CATEGORY_KNOWN_PATHS, "/Applications/", IFACE_("Applications"), ICON_WINDOW, FS_INSERT_LAST);

fsmenu_insert_entry(fsmenu, FS_CATEGORY_KNOWN_PATHS, "/", NULL, ICON_DISK_DRIVE, FS_INSERT_LAST);

@Harley Acheson (harley) just an explanation for the previous post.

In the Windows version of this patch you get icons/names from the System list, which are hardcoded for Windows and Linux.
But on Mac this list (taken from the Finder) is user-defined, so not all known system folders can be present in it.
So my idea is to have a separate list with all known system folders and take icons from it.

Yevgeny Makarov (jenkm) edited the summary of this revision. (Show Details)