comparison gui/dialog/fileselect.c @ 35847:25af0fce844f

Keep GUI history entries in order. Currently, if an entry is to be added to the GUI history and this entry is already existing, it is swapped with the top entry. This breaks history sequence and is confusing. Move this entry to the top while leaving the other ones in their order. Patch by Hans-Dieter Kosch, hdkosch kabelbw de.
author ib
date Sun, 10 Mar 2013 14:25:02 +0000
parents dbfedb331095
children 19863172756d
comparison
equal deleted inserted replaced
35846:1994a2fd15f4 35847:25af0fce844f
384 } 384 }
385 385
386 static void fs_PersistantHistory( char * subject ) 386 static void fs_PersistantHistory( char * subject )
387 { 387 {
388 unsigned int i; 388 unsigned int i;
389 char * entry;
389 390
390 if ( fsType != fsVideoSelector ) return; 391 if ( fsType != fsVideoSelector ) return;
391 392
392 for ( i=0;i < FF_ARRAY_ELEMS(fsHistory);i++ ) 393 for ( i=0;i < FF_ARRAY_ELEMS(fsHistory);i++ )
393 if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) ) 394 if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) )
394 { 395 {
395 char * tmp = fsHistory[i]; fsHistory[i]=fsHistory[0]; fsHistory[0]=tmp; 396 entry=fsHistory[i];
396 return; 397 break;
397 } 398 }
398 nfree( fsHistory[FF_ARRAY_ELEMS(fsHistory) - 1] ); 399 if ( i >= FF_ARRAY_ELEMS(fsHistory) )
399 for ( i=FF_ARRAY_ELEMS(fsHistory) - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1]; 400 {
400 fsHistory[0]=gstrdup( subject ); 401 i=FF_ARRAY_ELEMS(fsHistory)-1;
402 nfree( fsHistory[i] );
403 entry=gstrdup( subject );
404 }
405 for ( ;i;i-- ) fsHistory[i]=fsHistory[i - 1];
406 fsHistory[0]=entry;
401 } 407 }
402 /* ----------------------------------------------- */ 408 /* ----------------------------------------------- */
403 409
404 static void fs_fsFilterCombo_activate( GtkEntry * entry, 410 static void fs_fsFilterCombo_activate( GtkEntry * entry,
405 gpointer user_data ) 411 gpointer user_data )