Revamp "New Document" submenu
Current implementation builds a GMenuModel from the Templates directory tree. This was adequate for use with cascading
GtkMenu is gone in GTK 4, so now
GtkPopoverMenu is used instead. this implementation presents many problems:
- GtkPopoverMenu doesn't cope well with our implementation:
- If the Templates directory tree includes directories with the same basename, only one can be displayed because the stack page names would conflict.
- When the menu model is rebuilt (which is very frequent), the whole submenu hierarchy is rebuilt, which has been causing bugs since we have introduced the popover menu in the pathbar.
- GtkPopoverMenu submenus are subpages in a stack. Deeply nested Templates trees are too slow to navigate like this. This is also advised against in the HIG.
- The file icons set in the model are not exposed by GtkPopoverMenu.
In addition to this, the known problems of the old implementation still apply:
- If the Templates directory is empty, there is no submenu. This makes the feature hard to discover and makes users believe this feature doesn't exist. (#407 (closed) and its many duplicates).
- There is no ability to search.
- Optionally setting a file name is not part of the process. (#524)
- Expose the the whole tree of templates in a single view. instead of nested submenus.
- Show file type icons to help to visually find the relevant template.
- Allow searching the list of templates.
- Allow setting a custom name for the new file part of the process.
- Have the "New Documents" menu item always visible, even if the Templates directory is empty.
- Provide a useful empty state.
- Needs discussion with designers and a tentative design mockup.