New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set initial file icons based only on type #1490
Conversation
Seems sensible, and about right. Have you tested to see what the actual icons are like? (Put Since folders don't have extensions, this doesn't work. It may be better to use ...although I've just tested One other thing - can this be held off until #1488 is merged - your |
No need for that. All you have to do is look at the contents for a catalog entry. I've always known that part of the UI wouldn't update, but it's especially noticeable (and annoying) now. I thought it was because the prefs views aren't watching for Now I think that panel just calls
In practice, the icon always seems to be available, with the exception of the catalog prefs. But since folders are so common, I think it's worth adding a special case for them. Maybe a special case for volumes, too? Once we have that, I wonder if it's worth the effort to make the catalog prefs call
I'm running with them merged together and I think it makes sense as is. That is, your |
New commit for folders, but all isn't perfect. For example, launch QS and hold |
Hmm... I still think this should be done properly - we look at the actual file type, since now for anything without an extension we just get the generic icon file. Albeit not for very long, but annoying in the prefs as you say. If you just do
OK, I'll let you look into it
My
Yeah it should really show the real icon, I'll look into it |
Not quite. What we wanted was to avoid ever asking the disk for more information about the file. If you follow Now granted,
It's because holding
Pretty rare and cured by a restart of QS. Probably not worth reloading every icon every time.
Well, wait. The way the code is now (in #1488), it will only retain the icon if there was no Quick Look preview. So we're still calling Quick Look for things with previews, which is the expensive part. (And I think we should, since the preview can change when contents change.) I thought you were only trying to retain failures, as if to say "there is no useful icon for this thing, so stop trying to load one". In any case, I think we agree. If we find that a file didn't have a Quick Look preview, or the user has previews disabled, it makes sense to just retain the type-based icon. I'll see if #1488 can be merged, then rebase this on it. |
Calling `iconForFile:` causes the file's attributes to be read from disk, which could be very slow in some cases, defeating the purpose of `setQuickIcon…`. Instead, we do it in `loadIcon…` which runs in the background. fixes #1431
Yeah, just
Yeah, which is what I thought.
Exactly. Since if you edit a text file its quicklook preview changes. Looks like you agree and have merged anyway.
Again, looks like you're on it :) |
One question, though. Do we want to retain the "real" icon from |
They typically don't have an extension, so they need to be handled separately.
to avoid several attempting to update simultaneously
`setObjectValue:` is lacking some smarts for comparing objects and managing observers. `selectObjectValue:` takes care of that, as well as the two lines that were removed.
Force pushed. Let me know if you find any issues. Depending on your answer to my last question, it might be done. The way it is now, the initial type-based icon is retained if nothing better is found (which I think is what you were suggesting). If you want to also retain specific icons (but not Quick Look previews), I'll need to move some things around. |
I'd still class |
I would too, but in practice after trying it I think it "wastes" memory, considering how fast it is to just load the thing over again. I haven't heard anyone complain about waiting on plain file icons. I think we'd hear people complain about the memory footprint though. (It's a 25% - 60% increase for me and I didn't even leave QS running that long. I imagine it would get worse over time.) I've been testing quite a bit this morning. Here are some things I found.
|
Is there a reason why you haven't gone for what I suggested here. i.e. RE 536be7a I'd added this to one of my own branches, but I see you got there first ;-) I'm worried 4919bcd might break something somewhere else (I've battled with
I think 25-60% is a bit exaggerated ;-) After 10 minutes of testing I got 1.3% increase in memory usage (84.6MB as opposed to 83.5MB), but who knows if that's related to the icons. Probably is. I'll take your values with a pinch of salt and say 'OK' ;-) |
OK I see, I'd create a method like this for file objects: This gives the advantage that some things are given nicer icons. Doesn't seem to work that often though. stupid Apple for not making it easier. Aside: FYI, we can now start using NSURL's e.g. - CSS files have no 'real' defined UTI. Use mdls to see that it's |
I think that's just the diff looking weird. All I did was wrap that in a block without changing it.
Me too. I looked at the places that call both methods, and I think the change is OK. I also haven't run into any problems when testing, but another set of eyeballs is always good.
Maybe, but it was at least 25%. Try right-arrowing into Maybe it's more noticeable for me since I have Quick Look previews turned off for most types.
We could, but I feel like that would make things more confusing. When would you use that instead of I didn't want to address all that here, so I went with the (admittedly less elegant) one-line fix. |
You always convince me in the end... ;-)
Have you run into any issues? I must admit I haven't been running with these changes, but I will now for a few days, and see what I find. Anyway, all the |
The only issue I've seen is that the occasional application will have a generic document icon until you clear it from the object view, then call it back up. I was seeing that prior to 4919bcd. It happens so rarely, I haven't been able to troubleshoot. |
set initial file icons based only on type
A small change that should fix #1431.
If you look at the comment above my change in
setQuickIconForObject:
(or if you just think about it), it should have been this way all along.I wonder if it was in the past, because I remember
iconForFile:
was being called in both methods. I removed the call fromloadIconForObject:
at one point, but I've put it back with this commit.