1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

dtstyle: Alphabetically sort the backdrops in the backdrop list.

This commit is contained in:
Peter Howkins 2013-09-03 14:34:11 +01:00
parent c6f1d5ac05
commit d57739782f

View file

@ -42,6 +42,8 @@
/* include files */ /* include files */
/*+++++++++++++++++++++++++++++++++++++++*/ /*+++++++++++++++++++++++++++++++++++++++*/
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#if defined(_AIX) || defined(__apollo) #if defined(_AIX) || defined(__apollo)
@ -538,6 +540,17 @@ MoreBitmaps( void )
backdrops.maxNumBitmaps += 100; backdrops.maxNumBitmaps += 100;
} }
/************************************************************************
* cmpstringp()
* qsort() sort function, used for sorting bitmap names into alphabetical order
* can't use strcmp() due to char** rather than char*
************************************************************************/
static int
cmpstringp(const void *p1, const void *p2)
{
return strcmp(*(char * const *) p1, *(char * const *) p2);
}
/************************************************************************ /************************************************************************
* ReadBitmaps() * ReadBitmaps()
* Create an array of bitmaps by reading backdrop directories in the * Create an array of bitmaps by reading backdrop directories in the
@ -596,6 +609,9 @@ static
return 0; return 0;
} }
/* Sort the list into alphanetical order */
qsort(backdrops.tmpBitmapNames, backdrops.tmpNumBitmaps, sizeof(char *), cmpstringp);
/* get the fg/bg colors from Dtwm */ /* get the fg/bg colors from Dtwm */
if (backdrops.newColors) if (backdrops.newColors)
{ {