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

Add saved files to "recent files". Fix #1281. #1461

Closed
wants to merge 3 commits into from

Conversation

aguillon
Copy link
Contributor

Hi!

I tried to fix #1281 using the Gtk RecentManager but I am only partially satisfied and would like some advice:

  • I don't understand why operations on files appear in 3 different files (Services/Document.vala, FolderManager/FileItem.vala and FolderManager/File.vala). I get that renaming a file from the view is a bit different than saving it, and the logic is quite different as well, but shouldn't all of this be refactored together somehow?
  • The present code seems to work for "Save" and "Save as" (as well as automatic save) but not renames. Using another program, I have checked that renames were correctly saved in the manager but they don't seem to appear in the recent files, and I don't know why.

I don't know how to fix this for renames. Any advice?

@aguillon
Copy link
Contributor Author

When I say that it "does not work with renames", I mean "adding the same code to the two rename operations in the two other files" does not work, of course.

I just found out about elementary/files#2274. I'll try again with Nautilus tomorrow.

@jeremypw
Copy link
Collaborator

jeremypw commented Sep 2, 2024

@aguillon Thanks for looking into this! At present saving the file is the responsibility of the Document service. Renaming the file, however is down to the sidebar (FolderManager) in one place only, that is, Item.rename (). The rest of the code is to do with constructing the context menu and coordinating with the corresponding document to determine whether it is renameable. So you should be able to add RecentManager code to the Item rename function to get it to work with renames.

I agree it could be simpler to move the rename function to the tab context menu and/or the document context menu. It seems to be a convention to have the rename option in the sidebar however (at least GEdit does). You would still have to make sure the name in the sidebar is in sync with the document. This is outside the scope of this PR, so would need a separate PR.

@jeremypw
Copy link
Collaborator

jeremypw commented Oct 6, 2024

@aguillon Are you still working on this? I have pushed a draft PR that fixes adding to Recent on renaming sidebar items. If you wish you can copy from this as you were the first to start work on this.

@aguillon
Copy link
Contributor Author

aguillon commented Oct 8, 2024

@jeremypw No, you can go ahead and take it. Sorry but I cannot find the time to do Linux development these days.

@jeremypw
Copy link
Collaborator

jeremypw commented Oct 8, 2024

Closing in favor of #1467

@jeremypw jeremypw closed this Oct 8, 2024
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.

Editing a file does not update Recent in Files
3 participants