[MPlayer-cvslog] r35941 - trunk/gui/dialog/fileselect.c

ib subversion at mplayerhq.hu
Sun Mar 10 15:25:02 CET 2013


Author: ib
Date: Sun Mar 10 15:25:02 2013
New Revision: 35941

Log:
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.

Modified:
   trunk/gui/dialog/fileselect.c

Modified: trunk/gui/dialog/fileselect.c
==============================================================================
--- trunk/gui/dialog/fileselect.c	Sun Mar 10 13:46:45 2013	(r35940)
+++ trunk/gui/dialog/fileselect.c	Sun Mar 10 15:25:02 2013	(r35941)
@@ -386,18 +386,24 @@ void HideFileSelect( void )
 static void fs_PersistantHistory( char * subject )
 {
  unsigned int i;
+ char * entry;
 
  if ( fsType != fsVideoSelector ) return;
 
  for ( i=0;i < FF_ARRAY_ELEMS(fsHistory);i++ )
   if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) )
    {
-    char * tmp = fsHistory[i]; fsHistory[i]=fsHistory[0]; fsHistory[0]=tmp;
-    return;
+    entry=fsHistory[i];
+    break;
    }
- nfree( fsHistory[FF_ARRAY_ELEMS(fsHistory) - 1] );
- for ( i=FF_ARRAY_ELEMS(fsHistory) - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1];
- fsHistory[0]=gstrdup( subject );
+ if ( i >= FF_ARRAY_ELEMS(fsHistory) )
+  {
+   i=FF_ARRAY_ELEMS(fsHistory)-1;
+   nfree( fsHistory[i] );
+   entry=gstrdup( subject );
+  }
+ for ( ;i;i-- ) fsHistory[i]=fsHistory[i - 1];
+ fsHistory[0]=entry;
 }
 /* ----------------------------------------------- */
 


More information about the MPlayer-cvslog mailing list