@@ -262,8 +262,7 @@ namespace Scratch.FolderManager {
262262 return new_item;
263263 }
264264
265- // Adapted from Files app code
266- // Recursively load templates from folder and subfolders keeping count of total templates
265+ // Recursively load templates from folder and subfolders keeping count of total menuitems
267266 const int MAX_TEMPLATES = 2048 ;
268267 private uint load_templates_from_folder (GLib .File template_folder , Menu template_submenu ) {
269268 GLib . List<GLib . File > template_list = null ;
@@ -324,23 +323,21 @@ namespace Scratch.FolderManager {
324323 return count;
325324 }
326325
327- if (template_list. length () > 0 ) {
328- template_list. sort ((a, b) = > {
329- return strcmp (a. get_basename (). down (), b. get_basename (). down ());
330- });
326+ template_list. sort ((a, b) = > {
327+ return strcmp (a. get_basename (). down (), b. get_basename (). down ());
328+ });
331329
332- template_list. @foreach ((template) = > {
333- var template_menuitem = new MenuItem (
334- template. get_basename (),
335- GLib . Action . print_detailed_name (
336- FileView . ACTION_PREFIX + FileView . ACTION_NEW_FROM_TEMPLATE ,
337- new Variant (" (ss)" , this . path, template. get_path ())
338- )
339- );
330+ template_list. @foreach ((template) = > {
331+ var template_menuitem = new MenuItem (
332+ template. get_basename (),
333+ GLib . Action . print_detailed_name (
334+ FileView . ACTION_PREFIX + FileView . ACTION_NEW_FROM_TEMPLATE ,
335+ new Variant (" (ss)" , this . path, template. get_path ())
336+ )
337+ );
340338
341- template_submenu. append_item (template_menuitem);
342- });
343- }
339+ template_submenu. append_item (template_menuitem);
340+ });
344341
345342 return count;
346343 }
0 commit comments