X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-libraries.git;a=blobdiff_plain;f=minimenu%2Fmmui.c;h=b1e57c680dbf7cbd7bf95110ed8bb1cd24407498;hp=aeafcd6b17955718fcaf0010bcb0fb4a6e76f6a0;hb=d703366bcfec338f1dd9b95d2f643bc6a48f5de1;hpb=63d58c6d888ed100b997e66d7b63474cdfa6ad75 diff --git a/minimenu/mmui.c b/minimenu/mmui.c index aeafcd6..b1e57c6 100644 --- a/minimenu/mmui.c +++ b/minimenu/mmui.c @@ -2700,6 +2700,10 @@ void ui_revealscreen ( void ) { unsigned int labelmax = 0; unsigned int i; + if ( ! _categories_inviscount ) { + return; // nothing to do + } + for ( i = 0; i < _categories_inviscount; i++ ) { labels [ labelmax++ ] = _categories_invis [ i ].catname; } @@ -2714,18 +2718,31 @@ void ui_revealscreen ( void ) { return; } + // fix up category name, if its been hacked + if ( strchr ( _categories_invis [ sel ].catname, '.' ) ) { + char *t = _categories_invis [ sel ].catname; + _categories_invis [ sel ].catname = strdup ( strchr ( _categories_invis [ sel ].catname, '.' ) + 1 ); + free ( t ); + } + // copy invisi-cat into live-cat memmove ( &(g_categories [ g_categorycount ]), &(_categories_invis [ sel ]), sizeof(mm_category_t) ); g_categorycount++; + // move subsequent invisi-cats up, so the selected invisi-cat is nolonger existing in invisi-list at + // all (avoid double-free() later) + memmove ( &(_categories_invis [ sel ]), &(_categories_invis [ sel + 1 ]), sizeof(mm_category_t) * ( _categories_inviscount - sel - 1 ) ); + _categories_inviscount--; + // switch to the new category ui_category = g_categorycount - 1; + // ensure visibility unsigned int screen_width = pnd_conf_get_as_int_d ( g_conf, "display.screen_width", 800 ); unsigned int tab_width = pnd_conf_get_as_int ( g_conf, "tabs.tab_width" ); if ( ui_category > ui_catshift + ( screen_width / tab_width ) - 1 ) { - //ui_catshift++; ui_catshift = ui_category - ( screen_width / tab_width ) + 1; } + // redraw tabs render_mask |= CHANGED_CATEGORY; }