From 67d49958736f89e73c96f0ce67b764b8714dcb5b Mon Sep 17 00:00:00 2001 From: skeezix Date: Mon, 15 Mar 2010 16:15:42 -0400 Subject: [PATCH] Added box-merge option for pnd_container, and added ability for mmenu to scan both menu and desktop application searchpaths --- include/pnd_container.h | 3 +++ lib/pnd_container.c | 18 ++++++++++++++++++ minimenu/mmcat.c | 2 ++ minimenu/mmenu.c | 12 ++++++++++-- 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/include/pnd_container.h b/include/pnd_container.h index e16381d..d1c374f 100644 --- a/include/pnd_container.h +++ b/include/pnd_container.h @@ -44,6 +44,9 @@ void *pnd_box_allocinsert ( pnd_box_handle box, char *key, unsigned int size ); */ void *pnd_box_find_by_key ( pnd_box_handle box, char *key ); +/* merge two box lists */ +unsigned char pnd_box_append ( pnd_box_handle box, pnd_box_handle append ); + /* should the user want to walk around the container, a couple basic functions are * provided. */ diff --git a/lib/pnd_container.c b/lib/pnd_container.c index bf07a20..e08080a 100644 --- a/lib/pnd_container.c +++ b/lib/pnd_container.c @@ -175,3 +175,21 @@ unsigned int pnd_box_get_size ( pnd_box_handle box ) { return ( count ); } + +unsigned char pnd_box_append ( pnd_box_handle box, pnd_box_handle append ) { + pnd_box_t *pbox = (pnd_box_t*) box; + pnd_box_t *pappend = (pnd_box_t*) append; + + if ( pbox -> head ) { + pnd_box_node_t *n = pbox -> head; + while ( n -> next ) { + n = n -> next; + } + // by now, n -> next == NULL + n -> next = pappend -> head; + } else { + pbox -> head = pappend -> head; + } + + return ( 1 ); +} diff --git a/minimenu/mmcat.c b/minimenu/mmcat.c index d09cf0f..eb63ad5 100644 --- a/minimenu/mmcat.c +++ b/minimenu/mmcat.c @@ -153,5 +153,7 @@ void category_freeall ( void ) { } // for + g_categorycount = 0; + return; } diff --git a/minimenu/mmenu.c b/minimenu/mmenu.c index 04a03ec..aadac02 100644 --- a/minimenu/mmenu.c +++ b/minimenu/mmenu.c @@ -295,8 +295,16 @@ void applications_scan ( void ) { ui_discoverscreen ( 1 /* clear screen */ ); // determine current app list, cache icons - 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 ); // ignore overrides for now + // - ignore overrides for now + 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 ); + pnd_log ( pndn_debug, "Looking for pnd applications here: %s\n", + pnd_conf_get_as_char ( g_desktopconf, "menu.searchpath" ) ); + pnd_box_handle menu_apps = pnd_disco_search ( pnd_conf_get_as_char ( g_desktopconf, "menu.searchpath" ), NULL ); + + pnd_box_append ( g_active_apps, menu_apps ); + g_active_appcount = pnd_box_get_size ( g_active_apps ); unsigned char maxwidth, maxheight; -- 2.39.5