Skip to content
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

Show the correct name after renaming a file #1116

Merged
merged 7 commits into from Sep 25, 2012
Merged

Show the correct name after renaming a file #1116

merged 7 commits into from Sep 25, 2012

Conversation

skurfer
Copy link
Member

@skurfer skurfer commented Sep 17, 2012

Fixes #1105. Not the cleanest fix, but there's a long comment to explain it.

Bonus fixes:

  • Don't return a new file (that clearly doesn't exist) if the rename fails.
  • Don't show the "Rename…" action if multiple files are selected. There was already code to prevent this, but validation wasn't turned on for the action.

@skurfer
Copy link
Member Author

skurfer commented Sep 18, 2012

Not sure. I had to lay it all out in a table to get it straight in my head. (FYI, GitHub's Markdown supports tables.)

On a system where the localized name matches the filesystem name:

action name label displayName
begin XYZ nil XYZ
rename to FOO FOO XYZ XYZ
set label nil FOO nil FOO

On a system where the localized name differs from the filesystem name:

action name label displayName
begin XYZ ABC ABC
rename to FOO FOO ABC ABC
set label nil FOO nil FOO

That's what you would want, right? For the name you just typed to appear in the interface? The only drawback I can see is that the object could live on for a long time (until a rescan) with no localized label. But is that a problem?

Other mitigating factors:

  • Files with localized names aren't the kind of thing you usually rename. (They probably belong to some application, and are not the things in ~/Documents.)
  • When you begin the rename process, the filesystem name is what appears in the third pane, so that's essentially what you're dealing with, and what should be displayed afterward.

So, it's fine …right? :-)

@skurfer
Copy link
Member Author

skurfer commented Sep 18, 2012

Changed the error to a notification. Much better.

@pjrobertson
Copy link
Member

pjrobertson commented Sep 18, 2012

Great! :D

On 18 September 2012 19:29, Rob McBroom notifications@github.com wrote:

Changed the error to a notification. Much better.


Reply to this email directly or view it on GitHubhttps://github.com//pull/1116#issuecomment-8664999.

@skurfer
Copy link
Member Author

skurfer commented Sep 20, 2012

The error notification needs to be localized, but I'm not really sure which .strings file to use. Do I need to create a new one for the plug-in? How do I tell the system to use it?

@tiennou
Copy link
Member

tiennou commented Sep 20, 2012

You should use NSLocalizedStringFromTableInBundle, you can pass nil if you want that to go in Localizable.string, and the plugin's bundle as the bundle. Then you should be all set as soon as I get genstrings to work like I want it to.

@pjrobertson
Copy link
Member

pjrobertson commented Sep 25, 2012

Testing this out now.

Looks like you may have inadvertently prevented a crash by using a notif :)

Previously with the NSAlert:

NSAlert is being used from a background thread, which is not safe. This is probably going to crash sometimes. Break on _NSAlertWarnUnsafeBackgroundThreadUsage to debug. This will be logged only once. This may break in the future.

Other than the localisation of the title in the notif, works great :D

pjrobertson added a commit that referenced this pull request Sep 25, 2012
Show the correct name after renaming a file
@pjrobertson pjrobertson merged commit 73ebf51 into quicksilver:master Sep 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Renaming a file does not change its label...
3 participants