From: skeezix Date: Mon, 15 Mar 2010 20:02:11 +0000 (-0400) Subject: Changed Start to Select .. so Start can start apps now (call it the CraigButton)... X-Git-Tag: Release-2010-05/1~56 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8e252d4665f11a2ff93fbd7bdbbbd55823d973c;p=pandora-libraries.git Changed Start to Select .. so Start can start apps now (call it the CraigButton); Select now brings up the menu with rescan apps, shutdown, etc. Rescan apps is now functional in the menu --- diff --git a/minimenu/TODO.txt b/minimenu/TODO.txt index d3f7ecf..8ca4af9 100644 --- a/minimenu/TODO.txt +++ b/minimenu/TODO.txt @@ -3,10 +3,9 @@ - full-replacement PXML is one option, another is - apply override to all sections that match -- by unique-id, so apply override to all sub-apps that apply? -- libpnd: appdata-dir-name +- libpnd: appdata-dir-name? - mmwrapper black screen? -- manual app rescan - conf .. use also menu searchpath - About screen - override diff --git a/minimenu/mmcat.c b/minimenu/mmcat.c index de4db3a..d09cf0f 100644 --- a/minimenu/mmcat.c +++ b/minimenu/mmcat.c @@ -134,3 +134,24 @@ void category_dump ( void ) { return; } + +void category_freeall ( void ) { + unsigned int i; + mm_appref_t *iter, *next; + + for ( i = 0; i < g_categorycount; i++ ) { + + iter = g_categories [ i ].refs; + + while ( iter ) { + next = iter -> next; + free ( iter ); + iter = next; + } + + g_categories [ i ].refs = NULL; + + } // for + + return; +} diff --git a/minimenu/mmcat.h b/minimenu/mmcat.h index 06605cf..25f8eb1 100644 --- a/minimenu/mmcat.h +++ b/minimenu/mmcat.h @@ -22,5 +22,6 @@ typedef struct { unsigned char category_push ( char *catname, pnd_disco_t *app ); // catname is not pulled from app, so we can make them up on the fly (ie: "All") mm_category_t *category_query ( char *catname ); void category_dump ( void ); // sort the apprefs +void category_freeall ( void ); #endif diff --git a/minimenu/mmenu.c b/minimenu/mmenu.c index 4a649c0..04a03ec 100644 --- a/minimenu/mmenu.c +++ b/minimenu/mmenu.c @@ -242,6 +242,54 @@ int main ( int argc, char *argv[] ) { /* inhale applications, icons, categories, etc */ + applications_scan(); + + /* actual work now + */ + + while ( 1 ) { // forever! + + // show the menu, or changes thereof + ui_render ( CHANGED_NOTHING ); + + // wait for input or time-based events (like animations) + // deal with inputs + ui_process_input ( 1 /* block */ ); + + // sleep? block? + usleep ( 5000 ); + + } // while + + return ( 0 ); +} + +void emit_and_quit ( char *s ) { + printf ( "%s\n", s ); + exit ( 0 ); +} + +void applications_free ( void ) { + + // free up all our category apprefs, but keep the preview and icon cache's.. + category_freeall(); + + // free up old disco_t + if ( g_active_apps ) { + pnd_disco_t *p = pnd_box_get_head ( g_active_apps ); + pnd_disco_t *n; + while ( p ) { + n = pnd_box_get_next ( p ); + pnd_disco_destroy ( p ); + p = n; + } + pnd_box_delete ( g_active_apps ); + } + + return; +} + +void applications_scan ( void ) { // show disco screen ui_discoverscreen ( 1 /* clear screen */ ); @@ -343,27 +391,5 @@ int main ( int argc, char *argv[] ) { // dump categories //category_dump(); - /* actual work now - */ - - while ( 1 ) { // forever! - - // show the menu, or changes thereof - ui_render ( CHANGED_NOTHING ); - - // wait for input or time-based events (like animations) - // deal with inputs - ui_process_input ( 1 /* block */ ); - - // sleep? block? - usleep ( 5000 ); - - } // while - - return ( 0 ); -} - -void emit_and_quit ( char *s ) { - printf ( "%s\n", s ); - exit ( 0 ); + return; } diff --git a/minimenu/mmenu.conf b/minimenu/mmenu.conf index 89cc7c3..759b578 100644 --- a/minimenu/mmenu.conf +++ b/minimenu/mmenu.conf @@ -21,7 +21,7 @@ font_rgba_b 220 # RGBA for the display text font_rgba_a 20 # RGBA for the display text battery_x 10 # (x,y) for battery level battery_y 450 # (x,y) for battery level -hintline Push START for shutdown options # shown at bottom of screen +hintline Push SELECT for shutdown options # shown at bottom of screen hint_x 275 # (x,y) for hint line hint_y 450 # (x,y) for hint line clock_x 650 # (x,y) for clock diff --git a/minimenu/mmenu.h b/minimenu/mmenu.h index ab17b5e..031443c 100644 --- a/minimenu/mmenu.h +++ b/minimenu/mmenu.h @@ -32,4 +32,7 @@ typedef enum { void emit_and_quit ( char *s ); +void applications_free ( void ); +void applications_scan ( void ); + #endif diff --git a/minimenu/mmui.c b/minimenu/mmui.c index a45de78..ad97111 100644 --- a/minimenu/mmui.c +++ b/minimenu/mmui.c @@ -861,6 +861,10 @@ void ui_process_input ( unsigned char block_p ) { ui_event++; } else if ( event.key.keysym.sym == SDLK_LALT ) { // start button + ui_push_exec(); + ui_event++; + + } else if ( event.key.keysym.sym == SDLK_LCTRL /*LALT*/ ) { // select button char *opts [ 20 ] = { "Return to Minimenu", "Shutdown Pandora", @@ -882,6 +886,13 @@ void ui_process_input ( unsigned char block_p ) { system ( buffer ); } else if ( sel == 2 ) { // rescan apps + pnd_log ( pndn_debug, "Freeing up applications\n" ); + applications_free(); + pnd_log ( pndn_debug, "Rescanning applications\n" ); + applications_scan(); + // reset view + ui_selected = NULL; + ui_rows_scrolled_down = 0; } else if ( sel == 3 ) { // run xfce char buffer [ PATH_MAX ];