Skip to content

Conversation

@jeremypw
Copy link
Collaborator

@jeremypw jeremypw commented Jun 29, 2025

Fixes #297

Adapted from Files code.

Some undecided issues:

(1) Should templates automatically enter rename mode (currrently not). I am assuming templates will be named something like "Application.vala" so will not need renaming.

(2) Should templates be automatically opened (currently not). I have kept the same behaviour as new file and folder but selected the new item so it can be easily opened if required.

(3) How to make where to put the template files more discoverable or configurable.

Screenshot from 2025-07-07 18 40 20

@jeremypw jeremypw added this to the 8.1 milestone Jun 29, 2025
@jeremypw jeremypw marked this pull request as ready for review July 6, 2025 12:59
@jeremypw jeremypw requested a review from a team July 6, 2025 13:00
@jeremypw jeremypw marked this pull request as draft July 6, 2025 13:05
@jeremypw
Copy link
Collaborator Author

jeremypw commented Jul 6, 2025

@danirabbit
I now notice that there is some quite extensive old code already implementing a "TemplateManager". but it is not clear how this was intended to work and afaict it has never actually worked? It appears to relate to "Project Templates" so maybe similar to the unmerged PR #996? Hopefully this PR does not duplicate existing code.

@jeremypw jeremypw marked this pull request as ready for review July 6, 2025 13:26
@jeremypw
Copy link
Collaborator Author

jeremypw commented Jul 6, 2025

Now implemented a setting for user specified template folder

@jeremypw
Copy link
Collaborator Author

jeremypw commented Jul 6, 2025

On second thoughts, I think we ought to enter renaming mode so the actual desired name can be entered more conveniently. I'll implement this soon.

@jeremypw
Copy link
Collaborator Author

jeremypw commented Jul 7, 2025

Turns out there are some recalcitrant timing issues in starting to edit the source list after adding a new item to it. There does not seem to be an elegant way to reliably determine that the sourcelist is in a state where it can be edited (the available signals like child-added arrive too early). In the end, after a lot of experimentation, I have just used fairly long timeouts 😞 Hopefully in Gtk4 this will not be necessary.

@Marukesu
Copy link
Contributor

Marukesu commented Jul 7, 2025

Now implemented a setting for user specified template folder

I don't think we should have a setting for the template folder, this should be using GLib.Environment.get_user_special_dir (TEMPLATES) and if the user wants to change the template folder it can do by changing the value of the XDG_TEMPLATES_DIR variable.

@jeremypw
Copy link
Collaborator Author

jeremypw commented Jul 8, 2025

I don't think we should have a setting for the template folder

The idea is to keep Code specific templates separate (I am not sure why templates for different apps should all be in the same folder tbh). However, I'll bow to majority opinion and revert that.

@jeremypw jeremypw mentioned this pull request Jul 18, 2025
2 tasks
@jeremypw jeremypw modified the milestones: 8.1, 8.2 Jul 23, 2025
@jeremypw jeremypw marked this pull request as draft October 18, 2025 16:52
@jeremypw
Copy link
Collaborator Author

Need to check whether this is prone to the hanging bug found in Files when the templates folder is very large.

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.

New file from template

3 participants