+ category_push ( catname, parentcatname /* parent cat */, app, ovrh, NULL /* fspath */, visiblep );
+
+ // if subcats as folders, then lets just make up a dummy app that pretends to be a folder,
+ // and stuff it into the parent cat
+ if ( parentcatname && pnd_conf_get_as_int_d ( g_conf, "tabs.subcat_as_folders", 1 ) ) {
+
+ // it is implicit that since we're talking parentcat, its already been created in a previous call
+ // therefore, we need to..
+ // i) find the parent cat
+ // ii) ensure it already has a faux-disco container
+ // iii) ensure that disco container doesn't already contain a disco-entry for this subcat
+ // iv) create the dummy app folder by pushing the disco into the apprefs as normal
+ // v) create a dummy '..' for going back up, in the child
+
+ mm_category_t *pcat = pnd_box_find_by_key ( m_categories, parentcatname );
+
+ if ( ! pcat -> disco ) {
+ pcat -> disco = pnd_box_new ( pcat -> catname );
+ }
+
+ // if this subcat is already in the faux-disco list, then its probably already
+ // handled so we needn't concern ourselves anymore. If not, then we can
+ // create it and push it into the parent as a new 'app'
+ pnd_disco_t *disco = pnd_box_find_by_key ( pcat -> disco, catname );
+
+ if ( ! disco ) {
+
+ disco = pnd_box_allocinsert ( pcat -> disco, catname, sizeof(pnd_disco_t) );
+ if ( disco ) {
+
+ // create the subcat faux-disco entry, and register into parent cat
+ char uid [ 30 ];
+ sprintf ( uid, "%p", catname );
+
+ disco -> unique_id = strdup ( uid );
+ if ( strchr ( catname, '.' ) ) {
+ disco -> title_en = strdup ( strchr ( catname, '.' ) + 1 );
+ } else {
+ disco -> title_en = strdup ( catname );
+ }
+ disco -> object_flags = PND_DISCO_GENERATED;
+ disco -> object_type = pnd_object_type_directory; // suggest to Grid that its a dir
+ disco -> object_path = strdup ( catname );
+
+ category_push ( parentcatname, NULL /* parent cat */, disco, 0 /*ovrh*/, NULL /* fspath */, 1 /* visible */ );
+
+ // create .. faux-disco entry into child cat
+ disco = pnd_box_allocinsert ( pcat -> disco, catname, sizeof(pnd_disco_t) );
+
+ sprintf ( uid, "%p", uid );
+
+ disco -> unique_id = strdup ( uid );
+ disco -> title_en = strdup ( ".." );
+ disco -> object_flags = PND_DISCO_GENERATED;
+ disco -> object_type = pnd_object_type_directory; // suggest to Grid that its a dir
+
+ category_push ( catname, parentcatname /* parent cat */, disco, 0 /*ovrh*/, NULL /* fspath */, 1 /* visible */ );
+
+ } // making faux disco entries
+
+ } // disco already exist?
+
+ } // subcat as folder?