+ // - ignore overrides for now
+
+ g_active_apps = 0;
+ pnd_box_handle merge_apps = 0;
+
+ // desktop apps?
+ if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.desktop_apps", 1 ) ) {
+ pnd_log ( pndn_debug, "Looking for pnd applications here: %s\n",
+ pnd_conf_get_as_char ( g_desktopconf, "desktop.searchpath" ) );
+ g_active_apps = pnd_disco_search ( pnd_conf_get_as_char ( g_desktopconf, "desktop.searchpath" ), NULL );
+ }
+
+ // menu apps?
+ if ( pnd_conf_get_as_int_d ( g_conf, "minimenu.menu_apps", 1 ) ) {
+ pnd_log ( pndn_debug, "Looking for pnd applications here: %s\n",
+ pnd_conf_get_as_char ( g_desktopconf, "menu.searchpath" ) );
+ merge_apps = pnd_disco_search ( pnd_conf_get_as_char ( g_desktopconf, "menu.searchpath" ), NULL );
+ }
+
+ // merge lists
+ if ( merge_apps ) {
+ if ( g_active_apps ) {
+ // the key from pnd_disco_search() is the _path_, so easy to look for duplicates
+ // this is pretty inefficient, being linked lists; perhaps should switch to hash tables when
+ // we expect thousands of apps.. or at least an index or something.
+ void *a = pnd_box_get_head ( merge_apps );
+ void *nexta = NULL;
+ while ( a ) {
+ nexta = pnd_box_get_next ( a );
+
+ // if the key for the node is also found in active apps, toss out the merging one
+ if ( pnd_box_find_by_key ( g_active_apps, pnd_box_get_key ( a ) ) ) {
+ //fprintf ( stderr, "Merging app id '%s' is duplicate; discarding it.\n", pnd_box_get_key ( a ) );
+ pnd_box_delete_node ( merge_apps, a );
+ }
+
+ a = nexta;
+ }
+
+ // got menu apps, and got desktop apps, merge
+ pnd_box_append ( g_active_apps, merge_apps );
+ } else {
+ // got menu apps, had no desktop apps, so just assign
+ g_active_apps = merge_apps;
+ }
+ }
+
+ // aux apps?
+ char *aux_apps = NULL;
+ merge_apps = 0;
+ aux_apps = pnd_conf_get_as_char ( g_conf, "minimenu.aux_searchpath" );
+ if ( aux_apps && aux_apps [ 0 ] ) {
+ pnd_log ( pndn_debug, "Looking for pnd applications here: %s\n", aux_apps );
+ merge_apps = pnd_disco_search ( aux_apps, NULL );
+ }
+
+ // merge aux apps
+ if ( merge_apps ) {
+ if ( g_active_apps ) {
+
+ // LAME: snipped from above; should just catenate the 3 sets of searchpaths into a
+ // master searchpath, possibly removing duplicate paths _then_, and keep all this much
+ // more efficient
+
+ // the key from pnd_disco_search() is the _path_, so easy to look for duplicates
+ // this is pretty inefficient, being linked lists; perhaps should switch to hash tables when
+ // we expect thousands of apps.. or at least an index or something.
+ void *a = pnd_box_get_head ( merge_apps );
+ void *nexta = NULL;
+ while ( a ) {
+ nexta = pnd_box_get_next ( a );
+
+ // if the key for the node is also found in active apps, toss out the merging one
+ if ( pnd_box_find_by_key ( g_active_apps, pnd_box_get_key ( a ) ) ) {
+ fprintf ( stderr, "Merging app id '%s' is duplicate; discarding it.\n", pnd_box_get_key ( a ) );
+ pnd_box_delete_node ( merge_apps, a );
+ }
+
+ a = nexta;
+ }
+
+ pnd_box_append ( g_active_apps, merge_apps );
+ } else {
+ g_active_apps = merge_apps;
+ }
+ }
+
+ // do it