From: skeezix Date: Tue, 6 Apr 2010 20:30:31 +0000 (-0400) Subject: Added SIGQUIT handler, which mkaes menu exit (and request mmwrapper also exit.) X-Git-Tag: Release-2010-05/1~19 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8030264ce94e95ddef77bfe38d622a4b221c45b0;p=pandora-libraries.git Added SIGQUIT handler, which mkaes menu exit (and request mmwrapper also exit.) --- diff --git a/minimenu/TODO.txt b/minimenu/TODO.txt index e19cfdf..efc0082 100644 --- a/minimenu/TODO.txt +++ b/minimenu/TODO.txt @@ -3,8 +3,17 @@ - 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? +- switch default skin to davec +- kill -3 .. request quit + - add font and fontcolour control to conf - About screen and shoutouts // konami code? +- Perhaps a seriesof conf sections for per-file-extension or per-mimetype or both + [Section-FILEEXT] and [Section-MIMETYPE] + icon /some/path + invoke /path/to/proggy/to/run/it + -- this would thus let us do things like invoke a video player + -- alternative: parse the MIME handlers for xfce (say), to poach the info. Could be really slow. - add check.. if bad skin reported by mmenu, have mmwrapper set it back to default? or mm itself do it? @@ -13,11 +22,6 @@ - deploy.. - .desktop for deployment, for running from xfce -- maybe: - - directory browser; easy hack - - future - - honor render_mask to know what to update - handle SD eject/insert? or leave on manual - add callback to pnd_disco_Search (maybe new func to not break cpas code), so can show number apps found so far - - note taking field diff --git a/minimenu/mmenu.c b/minimenu/mmenu.c index 95a8b4b..3c1800f 100644 --- a/minimenu/mmenu.c +++ b/minimenu/mmenu.c @@ -36,6 +36,7 @@ #include #include #include +#include // for sigaction #include "pnd_logger.h" #include "pnd_pxml.h" @@ -70,6 +71,8 @@ char g_skin_selected [ 100 ] = "default"; char *g_skinpath = NULL; // where 'skin_selected' is located .. the fullpath including skin-dir-name pnd_conf_handle g_skinconf = NULL; +void sigquit_handler ( int n ); + int main ( int argc, char *argv[] ) { int logall = -1; // -1 means normal logging rules; >=0 means log all! int i; @@ -173,6 +176,17 @@ int main ( int argc, char *argv[] ) { emit_and_quit ( MM_QUIT ); } + /* set up quit signal handler + */ + sigset_t ss; + sigemptyset ( &ss ); + + struct sigaction siggy; + siggy.sa_handler = sigquit_handler; + siggy.sa_mask = ss; /* implicitly blocks the origin signal */ + siggy.sa_flags = SA_RESTART; /* don't need anything */ + sigaction ( SIGQUIT, &siggy, NULL ); + /* category conf file */ { @@ -601,3 +615,8 @@ void applications_scan ( void ) { return; } + +void sigquit_handler ( int n ) { + pnd_log ( pndn_rem, "SIGQUIT received; graceful exit.\n" ); + emit_and_quit ( MM_QUIT ); +}