At present, it is not possible to delete predefined categories in the Template Manager, but it is possible for the user to try. => Deactivate (or don't show) the predefined categories in the Delete dialog.
This, and maybe we make it clear in the dialog title per "Delete User Category".
I took the names of the built-in categories from sfx2/inc/doctempl.hrc I'm not sure if it is the right approach, some categories are missing (draw category). Is the list incomplete? https://gerrit.libreoffice.org/c/core/+/113712
Works for me, including the "draw" category. But UX-wise it's not really nice to list many things that can't be handled in the dialog. I would expect interaction with the currently active category only and close to the selection. Perhaps similar how we realized the CMIS dialog (File > Open Remote...). The view options could be in the settings (the gear icon) menu. Otherwise you should list only user categories or disable the command if none exists. A hurdle might be when the category is currently active and selected. In this case I get a message "could not delete <foo>". The same applies also to rename, which is not possible for the inbuilt categories.
I uploaded a new patch. I removed the category selection dialog and hid "Delete User Category" menu item for builtin templates. I didn't grey-out it because of the different behaviors of the VCL plugins. https://bugs.documentfoundation.org/show_bug.cgi?id=138246#c12 Or should I do it anyway? Currently rename item is also hidden in some cases (except for builtin categories).
*builtin categories not templates
Created attachment 171627 [details] Mockup Sorry for not been precise enough, here is a mockup. The point is that view options (thumb or list) are close to the category where actually the management functions belong. If we exchange the positions we do not need to explain a lot, it's pretty straightforward to what the functions belong. And whether Delete has a User in the label or not is not so important once it's disabled for inbuilt categories. We may go even further and have the template related functions move/im-export/extension with the refresh feature in the same menu.
I would also remove to capability to unset a default template on modules that are not yet shown. In case of All Application the command could be "Reset All Default Templates", for Writer "Reset Default Template for Text Documents" etc. Would be shorter but still readable without "Template".
It seems that set_item_visible(false) does not hide menu items in KF5/QT5 also set_sensitive(false) hides the item in KF5,QT5, Gen plugins and grey-outs in GTK3 plugin. You can see the same behavior in the remote files dialog. *I uploaded a WIP patch that greys-out items in GTK3 and hides them in KF5, QT5, etc. * "reset default $APP" only shows the option for the selected Application. *And the buttons are removed and moved to be all in the same menu. Let me know if I misunderstood something.
https://gerrit.libreoffice.org/c/core/+/113712
Vert D committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/06d063a9de41a24922f15cd3aa47411b61d30c23 tdf#138906 prevent built-in category deletion It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
It's ok now. Default templates are gray on Delete option. Verified in Version: 7.3.0.0.alpha0+ / LibreOffice Community Build ID: eac5977bfc11797eda356560a5e45c51108ef5a1 CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3 Locale: ro-RO (ro_RO.UTF-8); UI: en-US Calc: threaded
Could you please fix these: (soffice:16781): Gtk-CRITICAL **: 12:10:38.204: gtk_widget_show: assertion 'GTK_IS_WIDGET (widget)' failed (soffice:16781): Gtk-CRITICAL **: 12:10:38.204: gtk_widget_show: assertion 'GTK_IS_WIDGET (widget)' failed (soffice:16781): Gtk-CRITICAL **: 12:10:38.214: gtk_widget_set_sensitive: assertion 'GTK_IS_WIDGET (widget)' failed ? With gtk3 rendering, launch Writer then File/Templates/Manage Templates. It's due to https://gerrit.libreoffice.org/c/core/+/113712. See comment from Caolán in gerrit. Also, you can use "export G_DEBUG=fatal_warnings" to debug.
I fixed the warnings in this patch https://gerrit.libreoffice.org/c/core/+/119919