changeset 6713:cc917a581b6e

add simple playlist support
author pontscho
date Fri, 12 Jul 2002 00:53:26 +0000
parents 70aa7a20b9c0
children be17a987e0a1
files Gui/interface.c Gui/interface.h Gui/mplayer/gtk/fs.c Gui/mplayer/gtk/pl.c Gui/mplayer/gtk/pl.h Gui/mplayer/mw.h Gui/mplayer/play.c Gui/mplayer/play.h Gui/mplayer/widgets.c help_mp-en.h help_mp-hu.h mplayer.c
diffstat 12 files changed, 792 insertions(+), 267 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/interface.c	Thu Jul 11 22:01:40 2002 +0000
+++ b/Gui/interface.c	Fri Jul 12 00:53:26 2002 +0000
@@ -214,6 +214,8 @@
 	 btnModify( evSetBalance,guiIntfStruct.Balance );
 	}
 
+#if 0
+#warning video equalizer support disabled 
 	if ( gtkEnableVideoEqualizer )
 	 {
 	  gtkSet( gtkSetContrast,gtkContrast,NULL );
@@ -221,6 +223,7 @@
 	  gtkSet( gtkSetHue,gtkHue,NULL );
 	  gtkSet( gtkSetSaturation,gtkSaturation,NULL );
 	 }
+#endif
 	if ( gtkEnableAudioEqualizer )
 	 {
 	  equalizer_t eq;
@@ -291,13 +294,94 @@
 
 float gtkEquChannels[6][10];
 
-void gtkSet( int cmd,float fparam, void * vparam )
+plItem * plCurrent = NULL;
+plItem * plList = NULL;
+plItem * plLastPlayed = NULL;
+
+#if defined( MP_DEBUG ) && 0
+void list( void )
 {
- mp_cmd_t * mp_cmd = (mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) );
+ plItem * next = plList;
+ printf( "--- list ---\n" );
+ while( next || next->next )
+  {
+   printf( "item: %s/%s\n",next->path,next->name );
+   if ( next->next ) next=next->next; else break;
+  }
+ printf( "--- end of list ---\n" );
+}
+#else
+#define list();
+#endif
+
+void * gtkSet( int cmd,float fparam, void * vparam )
+{
+ mp_cmd_t    * mp_cmd = (mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) );
  equalizer_t * eq = (equalizer_t *)vparam;
+ plItem      * item = (plItem *)vparam;
  
  switch ( cmd )
   {
+// --- handle playlist
+   case gtkAddPlItem: // add item to platlist
+	if ( plList )
+	 {
+	  plItem * next = plList;
+	  while ( next->next ) { /*printf( "%s\n",next->name );*/ next=next->next; }
+	  next->next=item; item->prev=next;
+	 }
+	 else { item->prev=item->next=NULL; plCurrent=plList=item; }
+        list();
+        return NULL;
+   case gtkGetNextPlItem: // get current item from playlist
+	if ( plCurrent )
+	 {
+	  plCurrent=plCurrent->next;
+	  if ( !plCurrent && plList ) 
+	   {
+	    plItem * next = plList;
+	    while ( next->next ) { if ( !next->next ) break; next=next->next; }
+	    plCurrent=next;
+	   }
+	  return plCurrent;
+	 }
+        return NULL;
+   case gtkGetPrevPlItem:
+	if ( plCurrent )
+	 {
+	  plCurrent=plCurrent->prev;
+	  if ( !plCurrent && plList ) plCurrent=plList;
+	  return plCurrent;
+	 }
+	break;
+   case gtkGetCurrPlItem: // get current item
+        return plCurrent;
+   case gtkDelPl: // delete list
+        {
+	 plItem * curr = plList;
+	 plItem * next;
+	 if ( !plList ) return NULL;
+	 if ( !curr->next )
+	  {
+	   if ( curr->path ) free( curr->path );
+	   if ( curr->name ) free( curr->name );
+	   free( curr ); 
+	  }
+	  else
+	   {
+	    while ( curr->next )
+	     {
+	      next=curr->next;
+	      if ( curr->path ) free( curr->path );
+	      if ( curr->name ) free( curr->name );
+	      free( curr ); 
+	      curr=next;
+	     }
+	   }
+	  plList=NULL; plCurrent=NULL;
+	}
+        return NULL;
+// --- set equalizers
    case gtkSetContrast:
 	mp_cmd->id=MP_CMD_CONTRAST;   mp_cmd->name=strdup( "contrast" );
 	gtkContrast=fparam;
@@ -328,10 +412,11 @@
 	    for ( j=0;j<10;j++ )
 	     { tmp.channel=i; tmp.band=j; audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(int)&tmp ); }
 	  }
-	return;
-   default: free( mp_cmd ); return;
+	return NULL;
+   default: free( mp_cmd ); return NULL;
   }
  mp_cmd->args[0].v.i=(int)fparam;
  mp_cmd->args[1].v.i=1;
  mp_input_queue_cmd( mp_cmd );
+ return NULL;
 }
--- a/Gui/interface.h	Thu Jul 11 22:01:40 2002 +0000
+++ b/Gui/interface.h	Fri Jul 12 00:53:26 2002 +0000
@@ -130,11 +130,28 @@
 extern void guiGetEvent( int type,char * arg );
 extern void guiEventHandling( void );
 
+typedef struct _plItem 
+{
+ struct _plItem * prev,* next;
+ int       played;
+ char    * path;
+ char    * name;
+} plItem;
+
+extern plItem * plList;
+extern plItem * plCurrent;
+extern plItem * plLastPlayed;
+
 #define gtkSetContrast   0
 #define gtkSetBrightness 1
 #define gtkSetHue	 2
 #define gtkSetSaturation 3
 #define gtkSetEqualizer  4
+#define gtkAddPlItem     5
+#define gtkGetNextPlItem 6
+#define gtkGetPrevPlItem 7
+#define gtkGetCurrPlItem 8
+#define gtkDelPl         9
 
 extern float gtkContrast;
 extern float gtkBrightness;
@@ -143,7 +160,7 @@
 
 extern float gtkEquChannels[6][10];
 
-extern void gtkSet( int cmd,float param, void * vparam );
+extern void * gtkSet( int cmd,float param, void * vparam );
 
 #define gstrdup( s,ss ) { s=malloc( strlen( ss ) + 3 ); strcpy( s,ss ); }
 
--- a/Gui/mplayer/gtk/fs.c	Thu Jul 11 22:01:40 2002 +0000
+++ b/Gui/mplayer/gtk/fs.c	Fri Jul 12 00:53:26 2002 +0000
@@ -419,7 +419,7 @@
  gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile );
  fsPressed=1;
  if( !bevent ) return;
- if( bevent->type == GDK_2BUTTON_PRESS ) gtk_button_released( GTK_BUTTON( fsOk ) );
+ if( bevent->type == GDK_BUTTON_PRESS )  gtk_button_released( GTK_BUTTON( fsOk ) );
 }
 
 gboolean on_FileSelect_key_release_event( GtkWidget * widget,GdkEventKey * event,gpointer user_data )
--- a/Gui/mplayer/gtk/pl.c	Thu Jul 11 22:01:40 2002 +0000
+++ b/Gui/mplayer/gtk/pl.c	Fri Jul 12 00:53:26 2002 +0000
@@ -1,300 +1,664 @@
 
-#include "../../events.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+
 #include "../../../config.h"
 #include "../../../help_mp.h"
 
+#include "../../interface.h"
 #include "../widgets.h"
 #include "pl.h"
 
+static char * book_open_xpm[] = {
+	"16 16 4 1",
+	"       c None s None",
+	".      c black",
+	"X      c #808080",
+	"o      c white",
+	"                ",
+	"  ..            ",
+	" .Xo.    ...    ",
+	" .Xoo. ..oo.    ",
+	" .Xooo.Xooo...  ",
+	" .Xooo.oooo.X.  ",
+	" .Xooo.Xooo.X.  ",
+	" .Xooo.oooo.X.  ",
+	" .Xooo.Xooo.X.  ",
+	" .Xooo.oooo.X.  ",
+	"  .Xoo.Xoo..X.  ",
+	"   .Xo.o..ooX.  ",
+	"    .X..XXXXX.  ",
+	"    ..X.......  ",
+	"     ..         ",
+	"                "};
+
+static char * book_closed_xpm[] = {
+	"16 16 6 1",
+	"       c None s None",
+	".      c black",
+	"X      c red",
+	"o      c yellow",
+	"O      c #808080",
+	"#      c white",
+	"                ",
+	"       ..       ",
+	"     ..XX.      ",
+	"   ..XXXXX.     ",
+	" ..XXXXXXXX.    ",
+	".ooXXXXXXXXX.   ",
+	"..ooXXXXXXXXX.  ",
+	".X.ooXXXXXXXXX. ",
+	".XX.ooXXXXXX..  ",
+	" .XX.ooXXX..#O  ",
+	"  .XX.oo..##OO. ",
+	"   .XX..##OO..  ",
+	"    .X.#OO..    ",
+	"     ..O..      ",
+	"      ..        ",
+	"                "};
+
+       GtkWidget * PlayList;
+static GtkWidget * CTDirTree;
+static GtkWidget * CLFiles;
+static GtkWidget * CLSelected;
+static GtkWidget * Add;
+static GtkWidget * Remove;
+static GtkWidget * Ok;
+static GtkWidget * Cancel;
+static GdkPixmap * pxOpenedBook;
+static GdkPixmap * pxClosedBook;
+static GdkBitmap * msOpenedBook;
+static GdkBitmap * msClosedBook;
+
+static int   gtkVPlaylist = 0;
+static int   NrOfEntrys = 0;
+static int   NrOfSelected = 0;
+static int * CLFileSelected = NULL;
+static int * CLListSelected = NULL;
+
+static int sigSel;
+static int sigUnsel;
+
+typedef struct
+{
+ int    scaned;
+ char * path;
+} DirNodeType;
+
+static GtkCTreeNode * sibling;
+static GtkCTreeNode * parent;
+static gchar        * current_path;
+static gchar        * old_path = NULL;
+
+static int compare_func(const void *a, const void *b)
+{
+ char * tmp;
+ int    i;
+ if ( !a || !b || !( (DirNodeType *)a )->path ) return -1;
+ tmp=strdup( (char *)b ); tmp[strlen( tmp )-1]=0;
+ i=strcmp( ( (DirNodeType *)a )->path,tmp );
+ free( tmp );
+ return i;
+}
+
+static void scan_dir( char * path );
+
+void ShowPlayList( void )
+{
+ if ( gtkVPlaylist ) gtkActive( PlayList );
+  else PlayList=create_PlayList();
+
+ if ( old_path && *old_path )
+  {
+   char         * currentdir = strdup( old_path );
+   char         * tpath,* pos;
+   GtkCTreeNode * node,* nextnode;
+   gboolean       leaf;
+   tpath=strdup( "/" );
+   pos=strtok( currentdir,"/" );
+   node=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),NULL,"/",compare_func );
+   do
+    {
+     char * tpathnew = g_strconcat( tpath,pos,"/",NULL );
+     free( tpath ); tpath=tpathnew;
+     nextnode=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),node,tpath,compare_func );
+     if ( !nextnode ) break;
+     node=nextnode;
+     pos=strtok( NULL,"/" );
+     gtk_ctree_get_node_info( GTK_CTREE( CTDirTree ),node,NULL,NULL,NULL,NULL,NULL,NULL,&leaf,NULL );
+     if ( !leaf && pos ) gtk_ctree_expand( GTK_CTREE( CTDirTree ),node );
+      else 
+       {
+        DirNodeType * DirNode;
+        gtk_ctree_select( GTK_CTREE( CTDirTree ),node );
+	DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( CTDirTree ),node );
+	current_path=DirNode->path;
+        scan_dir( DirNode->path );
+        if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
+	break;
+       }
+    } while( pos );
+   free( tpath );
+   free( currentdir );
+  }
+  else gtk_ctree_select( GTK_CTREE( CTDirTree ),parent );
+
+ gtk_clist_freeze( GTK_CLIST( CLSelected ) );
+ gtk_clist_clear( GTK_CLIST( CLSelected ) );
+ if ( plList )
+  {
+   plItem * next = plList;
+   while ( next || next->next )
+    {
+     char * text[1][3]; text[0][2]="";
+     text[0][0]=next->name;
+     text[0][1]=next->path;
+     gtk_clist_append( GTK_CLIST( CLSelected ),text[0] );
+     NrOfSelected++;
+     if ( next->next ) next=next->next; else break;
+    }
+   CLListSelected=calloc( 1,NrOfSelected * sizeof( int ) );
+  }
+ gtk_clist_thaw( GTK_CLIST( CLSelected ) );
+
+ gtk_widget_show( PlayList );
+}
+
 void HidePlayList( void )
 {
- gtk_widget_destroy( PlayList );
+ gtkVPlaylist=NrOfSelected=NrOfEntrys=0;
+ if ( CLListSelected ) free( CLListSelected ); CLListSelected=NULL;
+ if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=NULL;
+ if ( old_path ) free( old_path ); old_path=strdup( current_path );
+ gtk_widget_hide( PlayList );
+ gtk_widget_destroy( PlayList ); 
 }
 
-void pl_PlayList_destroy( GtkObject * object,gpointer user_data )
-{ HidePlayList(); }
-
-void pl_Add_released( GtkButton * button,gpointer user_data )
-{
-}
-
-void pl_Remove_released( GtkButton * button,gpointer user_data )
-{
-}
-
-void pl_Ok_released( GtkButton * button,gpointer user_data )
+static void plDestroy( GtkObject * object,gpointer user_data )
 { HidePlayList(); }
 
-void pl_Cancel_released( GtkButton * button,gpointer user_data )
-{ HidePlayList(); }
-
-void pl_DirTree_select_child( GtkTree * tree,GtkWidget * widget,gpointer user_data )
+static void plRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
 {
+ switch ( (int) user_data )
+  {
+   case 0: CLFileSelected[row]=1; break;
+   case 1: CLListSelected[row]=1; break;
+  }
 }
 
-void pl_DirTree_selection_changed( GtkTree * tree,gpointer user_data )
+static void plUnRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
 {
+ switch ( (int) user_data )
+  {
+   case 0: CLFileSelected[row]=0; break;
+   case 1: CLListSelected[row]=0; break;
+  }
 }
 
-void pl_DirTree_unselect_child( GtkTree * tree,GtkWidget * widget,gpointer user_data )
+static void plButtonReleased( GtkButton * button,gpointer user_data )
 {
-}
+ switch ( (int) user_data )
+ {
+  case 1: // ok
+       {
+        int i;
+	if ( plList ) gtkSet( gtkDelPl,0,NULL );
+	for ( i=0;i<NrOfSelected;i++ )
+	 {
+	  plItem * item;
+	  char * text[3];
+	  item=calloc( 1,sizeof( plItem ) );
+	  gtk_clist_get_text( GTK_CLIST( CLSelected ),i,0,&text[0] );
+	  gtk_clist_get_text( GTK_CLIST( CLSelected ),i,1,&text[1] );
+	  item->name=strdup( text[0] );
+	  item->path=strdup( text[1] );
+	  gtkSet( gtkAddPlItem,0,(void*)item );
+	 }
+	if ( plCurrent )
+	 {
+	  guiSetDF( guiIntfStruct.Filename,plCurrent->path,plCurrent->name );
+	  guiIntfStruct.FilenameChanged=1;
+	  guiIntfStruct.StreamType=STREAMTYPE_FILE;
+	 }
+       }
+  case 0: // cancel
+       HidePlayList(); 
+       break;
+  case 2: // remove
+       {
+	int i; int c=0;
+
+	gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigSel );
+	gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigUnsel );
 
-void pl_FNameList_select_child( GtkList * list,GtkWidget * widget,gpointer user_data )
-{
-}
+        gtk_clist_freeze( GTK_CLIST( CLSelected ) );
+        for ( i=0;i<NrOfSelected;i++ )
+  	 if ( CLListSelected[i] ) 
+	  {
+	   gtk_clist_remove( GTK_CLIST( CLSelected ),i - c );
+	   c++;
+	  }
+	NrOfSelected-=c;
+	gtk_clist_thaw( GTK_CLIST( CLSelected ) );
+
+	gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigSel );
+	gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigUnsel );
 
-void pl_FNameList_selection_changed( GtkList * list,gpointer user_data )
-{
+       }
+       break;
+  case 3: // add
+       {
+        int i;
+        char * itext[1][2];
+        char * text[1][3]; text[0][2]="";
+        gtk_clist_freeze( GTK_CLIST( CLSelected ) );
+        for ( i=0;i<NrOfEntrys;i++ )
+         {
+          if ( CLFileSelected[i] )
+           {
+	    gtk_clist_get_text( GTK_CLIST( CLFiles ),i,0,&itext );
+	    text[0][0]=itext[0][0]; text[0][1]=current_path;
+	    gtk_clist_append( GTK_CLIST( CLSelected ),text[0] );
+	    NrOfSelected++;
+	    CLListSelected=realloc( CLListSelected,NrOfSelected * sizeof( int ) );
+	    CLListSelected[NrOfSelected - 1]=0;
+	   }
+	 }
+	gtk_clist_thaw( GTK_CLIST( CLSelected ) );
+       }
+       break;
+ }
 }
 
-void pl_FNameList_unselect_child( GtkList * list,GtkWidget * widget,gpointer user_data )
+static int check_for_subdir( gchar * path )
 {
+ DIR 	       * dir;
+ struct dirent * dirent;
+ struct stat     statbuf;
+ gchar 	       * npath;
+
+ if ( (dir=opendir( path )) )
+  {
+   while ( (dirent=readdir( dir )) )
+    {
+     if ( dirent->d_name[0] != '.' )
+      {
+       npath=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 );
+       sprintf( npath,"%s/%s",path,dirent->d_name );
+       if ( stat( npath,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) )
+        { free( npath ); closedir( dir ); return 1; }
+       free( npath );
+      }
+    }
+   closedir( dir );
+  }
+ return 0;
 }
 
-void pl_SelectedList_select_child( GtkList * list,GtkWidget * widget,gpointer user_data )
+static void plCTree( GtkCTree * ctree,GtkCTreeNode * parent_node,gpointer user_data )
 {
-}
+ GtkCTreeNode  * node;
+ DirNodeType   * DirNode;
+ gchar 		   * text;
+ gchar 		   * dummy = "dummy";
+ int     	 	 subdir = 1;
+ DIR   		   * dir = NULL;
+ struct dirent * dirent;
+ gchar  	   * path;
+ struct 		 stat statbuf;
 
-void pl_SelectedList_selection_changed( GtkList * list,gpointer user_data )
-{
-}
+ DirNode=gtk_ctree_node_get_row_data( ctree,parent_node );
+ if ( !DirNode->scaned )
+  {
+   DirNode->scaned=1; current_path=DirNode->path;
+   gtk_clist_freeze( GTK_CLIST( ctree ) );
+   node=gtk_ctree_find_by_row_data( ctree,parent_node,NULL );
+   gtk_ctree_remove_node( ctree,node );
+			   
+   if ( (dir=opendir( DirNode->path ) ) )
+    {
+     while( (dirent=readdir( dir )) )
+      {
+       path=calloc( 1,strlen( DirNode->path ) + strlen( dirent->d_name ) + 2 );
+       if ( !strcmp( current_path,"/" ) ) sprintf( path,"/%s",dirent->d_name );
+	else sprintf( path,"%s/%s",current_path,dirent->d_name );
+       text=dirent->d_name;
 
-void pl_SelectedList_unselect_child( GtkList * list,GtkWidget * widget,gpointer user_data )
-{
+       if ( stat( path,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) && dirent->d_name[0] != '.' )
+	{
+	 DirNode=malloc( sizeof( DirNodeType ) ); DirNode->scaned=0; DirNode->path=strdup( path );
+	 subdir=check_for_subdir( path );
+	 node=gtk_ctree_insert_node( ctree,parent_node,NULL,&text,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,!subdir,FALSE );
+	 gtk_ctree_node_set_row_data_full( ctree,node,DirNode,NULL );
+	 if ( subdir ) node=gtk_ctree_insert_node( ctree,node,NULL,&dummy,4,NULL,NULL,NULL,NULL,FALSE,FALSE );
+	}
+       free( path ); path=NULL;
+      }
+     closedir( dir );
+    }
+		    
+   gtk_ctree_sort_node( ctree,parent_node );
+   gtk_clist_thaw( GTK_CLIST( ctree ) );
+  }
 }
 
-GtkWidget* create_PlayList( void )
+static void scan_dir( char * path )
+{
+ DIR   		   * dir = NULL;
+ char		   * curr;
+ struct dirent * dirent;
+ struct 		 stat statbuf;
+ char 		   * text[1][2]; text[0][1]="";
+
+ gtk_clist_clear( GTK_CLIST( CLFiles ) );
+ if ( (dir=opendir( path )) )
+  {
+   NrOfEntrys=0;
+   while( (dirent=readdir( dir )) )
+    {
+	 curr=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 ); sprintf( curr,"%s/%s",path,dirent->d_name );
+	 if ( stat( curr,&statbuf ) != -1 && ( S_ISREG( statbuf.st_mode ) || S_ISLNK( statbuf.st_mode ) ) )
+	  {
+	   text[0][0]=dirent->d_name;
+	   gtk_clist_append( GTK_CLIST( CLFiles ),text[0] );
+	   NrOfEntrys++;
+	  }
+	 free( curr );
+	}
+   closedir( dir );
+   gtk_clist_sort( GTK_CLIST( CLFiles ) );
+  }
+}
+
+static void plCTRow(GtkWidget * widget, gint row, gint column, GdkEventButton * bevent, gpointer data)
 {
-  GtkWidget *PlayList;
-  GtkWidget *frame9;
-  GtkWidget *frame10;
-  GtkWidget *frame11;
-  GtkWidget *frame12;
-  GtkWidget *hbox5;
-  GtkWidget *frame13;
-  GtkWidget *frame14;
-  GtkWidget *DirTree;
-  GtkWidget *vbox6;
-  GtkWidget *frame15;
-  GtkWidget *FNameList;
-  GtkWidget *frame16;
-  GtkWidget *SelectedList;
-  GtkWidget *hseparator6;
-  GtkWidget *hbuttonbox5;
-  GtkWidget *Add;
-  GtkWidget *Remove;
-  GtkWidget *Ok;
-  GtkWidget *Cancel;
+ DirNodeType  * DirNode;
+ GtkCTreeNode * node;
+ node=gtk_ctree_node_nth( GTK_CTREE( widget ),row );
+ DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( widget ),node );
+ current_path=DirNode->path;
+ gtk_ctree_expand( GTK_CTREE( widget ),node );
+ scan_dir( DirNode->path );
+ if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
+}
+
+static void plShow( GtkWidget * widget,gpointer user_data )
+{ gtkVPlaylist=(int)user_data; }
 
-  PlayList = gtk_window_new( GTK_WINDOW_DIALOG );
-  gtk_object_set_data( GTK_OBJECT( PlayList ),MSGTR_PlayList,PlayList );
-  gtk_widget_set_usize( PlayList,512,256 );
-  GTK_WIDGET_SET_FLAGS( PlayList,GTK_CAN_FOCUS );
-  GTK_WIDGET_SET_FLAGS( PlayList,GTK_CAN_DEFAULT );
-  gtk_widget_set_events( PlayList,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK );
+GtkWidget * create_PlayList( void )
+{
+  GtkWidget 	* frame1;
+  GtkWidget 	* frame2;
+  GtkWidget 	* frame3;
+  GtkWidget 	* frame4;
+  GtkWidget 	* vbox1;
+  GtkWidget 	* hbox1;
+  GtkWidget 	* frame5;
+  GtkWidget 	* scrolledwindow1;
+  GtkWidget 	* label2;
+  GtkWidget 	* frame6;
+  GtkWidget 	* vbox2;
+  GtkWidget 	* scrolledwindow2;
+  GtkWidget 	* label3;
+  GtkWidget 	* hseparator2;
+  GtkWidget 	* scrolledwindow3;
+  GtkWidget 	* label5;
+  GtkWidget 	* hseparator1;
+  GtkWidget 	* hbuttonbox1;
+  GtkAccelGroup * accel_group;
+  GdkColor 		  transparent = { 0 };
+  gchar 		* root = "/";
+  gchar 		* dummy = "dummy";
+  DirNodeType 	* DirNode;
+
+  accel_group=gtk_accel_group_new();
+
+  PlayList=gtk_window_new( GTK_WINDOW_DIALOG );
+  gtk_object_set_data( GTK_OBJECT( PlayList ),"PlayList",PlayList );
+  gtk_widget_set_usize( PlayList,512,300 );
   gtk_window_set_title( GTK_WINDOW( PlayList ),MSGTR_PlayList );
   gtk_window_set_position( GTK_WINDOW( PlayList ),GTK_WIN_POS_CENTER );
-  gtk_window_set_policy( GTK_WINDOW( PlayList ),FALSE,FALSE,TRUE );
+//  gtk_window_set_policy( GTK_WINDOW( PlayList ),FALSE,FALSE,FALSE );
+  gtk_window_set_wmclass( GTK_WINDOW( PlayList ),"Playlist","MPlayer" );
+
+  gtk_widget_realize( PlayList );
+  gtkAddIcon( PlayList );
 
-  frame9 = gtk_frame_new( NULL );
-  gtk_widget_ref( frame9 );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame9",frame9,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( frame9 );
-  gtk_container_add( GTK_CONTAINER( PlayList ),frame9 );
-  gtk_container_set_border_width( GTK_CONTAINER( frame9 ),1 );
-  gtk_frame_set_shadow_type( GTK_FRAME( frame9 ),GTK_SHADOW_IN );
+  frame1=gtk_frame_new( NULL );
+  gtk_widget_ref( frame1 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame1",frame1,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( frame1 );
+  gtk_container_add( GTK_CONTAINER( PlayList ),frame1 );
+  gtk_container_set_border_width( GTK_CONTAINER( frame1 ),1 );
+  gtk_frame_set_shadow_type( GTK_FRAME( frame1 ),GTK_SHADOW_IN );
 
-  frame10 = gtk_frame_new( NULL );
-  gtk_widget_ref( frame10 );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame10",frame10,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( frame10 );
-  gtk_container_add( GTK_CONTAINER( frame9 ),frame10 );
-  gtk_frame_set_shadow_type( GTK_FRAME( frame10 ),GTK_SHADOW_NONE );
+  frame2=gtk_frame_new( NULL );
+  gtk_widget_ref( frame2 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame2",frame2,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( frame2 );
+  gtk_container_add( GTK_CONTAINER( frame1 ),frame2 );
+  gtk_frame_set_shadow_type( GTK_FRAME( frame2 ),GTK_SHADOW_NONE );
 
-  frame11 = gtk_frame_new( NULL );
-  gtk_widget_ref( frame11 );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame11",frame11,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( frame11 );
-  gtk_container_add( GTK_CONTAINER( frame10 ),frame11 );
-  gtk_frame_set_shadow_type( GTK_FRAME( frame11 ),GTK_SHADOW_ETCHED_OUT );
+  frame3=gtk_frame_new( NULL );
+  gtk_widget_ref( frame3 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame3",frame3,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( frame3 );
+  gtk_container_add( GTK_CONTAINER( frame2 ),frame3 );
+  gtk_frame_set_shadow_type( GTK_FRAME( frame3 ),GTK_SHADOW_ETCHED_OUT );
+
+  frame4=gtk_frame_new( NULL );
+  gtk_widget_ref( frame4 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame4",frame4,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( frame4 );
+  gtk_container_add( GTK_CONTAINER( frame3 ),frame4 );
+  gtk_frame_set_shadow_type( GTK_FRAME( frame4 ),GTK_SHADOW_NONE );
 
-  frame12 = gtk_frame_new( NULL );
-  gtk_widget_ref( frame12 );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame12",frame12,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( frame12 );
-  gtk_container_add( GTK_CONTAINER( frame11 ),frame12 );
-  gtk_frame_set_shadow_type( GTK_FRAME( frame12 ),GTK_SHADOW_NONE );
+  vbox1=gtk_vbox_new( FALSE,0 );
+  gtk_widget_ref( vbox1 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"vbox1",vbox1,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( vbox1 );
+  gtk_container_add( GTK_CONTAINER( frame4 ),vbox1 );
 
-  hbox5 = gtk_hbox_new( FALSE,0 );
-  gtk_widget_ref( hbox5 );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hbox5",hbox5,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( hbox5 );
-  gtk_container_add( GTK_CONTAINER( frame12 ),hbox5 );
+  hbox1=gtk_hbox_new( FALSE,0 );
+  gtk_widget_ref( hbox1 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hbox1",hbox1,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( hbox1 );
+  gtk_box_pack_start( GTK_BOX( vbox1 ),hbox1,TRUE,TRUE,0 );
+
+  frame5=gtk_frame_new( NULL );
+  gtk_widget_ref( frame5 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame5",frame5,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( frame5 );
+  gtk_box_pack_start( GTK_BOX( hbox1 ),frame5,TRUE,TRUE,0 );
+  gtk_frame_set_shadow_type( GTK_FRAME( frame5 ),GTK_SHADOW_ETCHED_OUT );
 
-  frame13 = gtk_frame_new( NULL );
-  gtk_widget_ref( frame13 );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame13",frame13,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( frame13 );
-  gtk_box_pack_start( GTK_BOX( hbox5 ),frame13,TRUE,TRUE,0 );
-  gtk_frame_set_shadow_type( GTK_FRAME( frame13 ),GTK_SHADOW_ETCHED_OUT );
+  scrolledwindow1=gtk_scrolled_window_new( NULL,NULL );
+  gtk_widget_ref( scrolledwindow1 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"scrolledwindow1",scrolledwindow1,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( scrolledwindow1 );
+  gtk_container_add( GTK_CONTAINER( frame5 ),scrolledwindow1 );
+  gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
 
-  frame14 = gtk_frame_new( NULL );
-  gtk_widget_ref( frame14 );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame14",frame14,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( frame14 );
-  gtk_container_add( GTK_CONTAINER( frame13 ),frame14 );
-  gtk_frame_set_shadow_type( GTK_FRAME( frame14 ),GTK_SHADOW_NONE );
+  CTDirTree=gtk_ctree_new( 1,0 );
+  gtk_widget_ref( CTDirTree );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"CTDirTree",CTDirTree,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_signal_connect( GTK_OBJECT( CTDirTree ),"tree_expand",GTK_SIGNAL_FUNC( plCTree ),(void*)0 );
+  gtk_signal_connect( GTK_OBJECT( CTDirTree ),"select_row",GTK_SIGNAL_FUNC( plCTRow ),(void *)0 );
+  gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),CTDirTree );
+  gtk_clist_set_column_auto_resize( GTK_CLIST( CTDirTree ),0,TRUE );
+  gtk_clist_set_column_width( GTK_CLIST( CTDirTree ),0,80 );
+  gtk_clist_set_selection_mode( GTK_CLIST( CTDirTree ),GTK_SELECTION_SINGLE );
+  gtk_ctree_set_line_style( GTK_CTREE( CTDirTree ),GTK_CTREE_LINES_SOLID );
+  gtk_clist_column_titles_show( GTK_CLIST( CTDirTree ) );
+  gtk_clist_set_shadow_type( GTK_CLIST( CTDirTree ),GTK_SHADOW_NONE );
 
-  DirTree = gtk_tree_new();
-  gtk_widget_ref( DirTree );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"DirTree",DirTree,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( DirTree );
-  gtk_container_add( GTK_CONTAINER( frame14 ),DirTree );
-  gtk_widget_set_usize( DirTree,217,-2 );
+  gtk_widget_realize( PlayList );
+
+  if ( !pxOpenedBook ) pxOpenedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msOpenedBook,&transparent,book_closed_xpm );
+  if ( !pxClosedBook ) pxClosedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msClosedBook,&transparent,book_open_xpm );
 
-  vbox6 = gtk_vbox_new( FALSE,0 );
-  gtk_widget_ref( vbox6 );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"vbox6",vbox6,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( vbox6 );
-  gtk_box_pack_start( GTK_BOX( hbox5 ),vbox6,TRUE,TRUE,0 );
-
-  frame15 = gtk_frame_new( NULL );
-  gtk_widget_ref( frame15 );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame15",frame15,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( frame15 );
-  gtk_box_pack_start( GTK_BOX( vbox6 ),frame15,TRUE,TRUE,0 );
-  gtk_frame_set_shadow_type( GTK_FRAME( frame15 ),GTK_SHADOW_ETCHED_OUT );
+  parent=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),NULL,NULL,&root,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,FALSE,FALSE );
+  DirNode=malloc( sizeof( DirNodeType ) );
+  DirNode->scaned=0; DirNode->path=strdup( root );
+  gtk_ctree_node_set_row_data_full(GTK_CTREE( CTDirTree ),parent,DirNode,NULL );
+  sibling=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),parent,NULL,&dummy,4,NULL,NULL,NULL,NULL,TRUE,TRUE );
+  gtk_ctree_expand( GTK_CTREE( CTDirTree ),parent );
+  gtk_widget_show( CTDirTree );
+  
+  label2=gtk_label_new( MSGTR_PLAYLIST_DirectoryTree );
+  gtk_widget_ref( label2 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"label2",label2,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( label2 );
+  gtk_clist_set_column_widget( GTK_CLIST( CTDirTree ),0,label2 );
+  gtk_misc_set_alignment( GTK_MISC( label2 ),0.02,0.5 );
 
-  FNameList = gtk_list_new();
-  gtk_widget_ref( FNameList );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"FNameList",FNameList,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( FNameList );
-  gtk_container_add( GTK_CONTAINER( frame15 ),FNameList );
+  frame6=gtk_frame_new( NULL );
+  gtk_widget_ref( frame6 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame6",frame6,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( frame6 );
+  gtk_box_pack_start( GTK_BOX( hbox1 ),frame6,TRUE,TRUE,0 );
+  gtk_widget_set_usize( frame6,170,-2 );
+  gtk_frame_set_shadow_type( GTK_FRAME( frame6 ),GTK_SHADOW_ETCHED_OUT );
 
-  frame16 = gtk_frame_new( NULL );
-  gtk_widget_ref( frame16 );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame16",frame16,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( frame16 );
-  gtk_box_pack_start( GTK_BOX( vbox6 ),frame16,TRUE,TRUE,0 );
-  gtk_frame_set_shadow_type( GTK_FRAME( frame16 ),GTK_SHADOW_ETCHED_OUT );
+  vbox2=gtk_vbox_new( FALSE,0 );
+  gtk_widget_ref( vbox2 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"vbox2",vbox2,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( vbox2 );
+  gtk_container_add( GTK_CONTAINER( frame6 ),vbox2 );
+
+  scrolledwindow2=gtk_scrolled_window_new( NULL,NULL );
+  gtk_widget_ref( scrolledwindow2 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"scrolledwindow2",scrolledwindow2,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( scrolledwindow2 );
+  gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow2,TRUE,TRUE,0 );
+  gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow2 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
 
-  SelectedList = gtk_list_new();
-  gtk_widget_ref( SelectedList );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"SelectedList",SelectedList,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( SelectedList );
-  gtk_container_add( GTK_CONTAINER( frame16 ),SelectedList );
+  CLFiles=gtk_clist_new( 1 );
+  gtk_widget_ref( CLFiles );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"CLFiles",CLFiles,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( CLFiles );
+  gtk_container_add( GTK_CONTAINER( scrolledwindow2 ),CLFiles );
+  gtk_clist_set_column_width( GTK_CLIST( CLFiles ),0,80 );
+  gtk_clist_set_selection_mode( GTK_CLIST( CLFiles ),GTK_SELECTION_MULTIPLE );
+  gtk_clist_column_titles_show( GTK_CLIST( CLFiles ) );
+  gtk_clist_set_shadow_type( GTK_CLIST( CLFiles ),GTK_SHADOW_NONE );
+
+  label3=gtk_label_new( MSGTR_PLAYLIST_Files );
+  gtk_widget_ref( label3 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"label3",label3,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( label3 );
+  gtk_clist_set_column_widget( GTK_CLIST( CLFiles ),0,label3 );
+  gtk_misc_set_alignment( GTK_MISC( label3 ),0.02,0.5 );
 
-  hseparator6 = gtk_hseparator_new();
-  gtk_widget_ref( hseparator6 );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hseparator6",hseparator6,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( hseparator6 );
-  gtk_box_pack_start( GTK_BOX( vbox6 ),hseparator6,FALSE,TRUE,0 );
-  gtk_widget_set_usize( hseparator6,-2,11 );
+  hseparator2=gtk_hseparator_new();
+  gtk_widget_ref( hseparator2 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hseparator2",hseparator2,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( hseparator2 );
+  gtk_box_pack_start( GTK_BOX( vbox2 ),hseparator2,FALSE,FALSE,0 );
+  gtk_widget_set_usize( hseparator2,-2,3 );
+
+  scrolledwindow3=gtk_scrolled_window_new( NULL,NULL );
+  gtk_widget_ref( scrolledwindow3 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"scrolledwindow3",scrolledwindow3,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( scrolledwindow3 );
+  gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow3,TRUE,TRUE,0 );
+  gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow3 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
+
+  CLSelected=gtk_clist_new( 2 );
+  gtk_widget_ref( CLSelected );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"CLSelected",CLSelected,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( CLSelected );
+  gtk_container_add( GTK_CONTAINER( scrolledwindow3 ),CLSelected );
+  gtk_clist_set_column_width( GTK_CLIST( CLSelected ),0,295 );
+  gtk_clist_set_column_width( GTK_CLIST( CLSelected ),1,295 );
+  gtk_clist_set_selection_mode( GTK_CLIST( CLSelected ),GTK_SELECTION_MULTIPLE );
+  gtk_clist_column_titles_show( GTK_CLIST( CLSelected ) );
+  gtk_clist_set_shadow_type( GTK_CLIST( CLSelected ),GTK_SHADOW_NONE );
 
-  hbuttonbox5 = gtk_hbutton_box_new();
-  gtk_widget_ref( hbuttonbox5 );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hbuttonbox5",hbuttonbox5,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
-  gtk_widget_show( hbuttonbox5 );
-  gtk_box_pack_start( GTK_BOX( vbox6 ),hbuttonbox5,FALSE,FALSE,0 );
-  gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox5 ),GTK_BUTTONBOX_END );
-  gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox5 ),0 );
-  gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox5 ),65,27 );
-  gtk_button_box_set_child_ipadding( GTK_BUTTON_BOX( hbuttonbox5 ),2,0 );
+  label5=gtk_label_new( MSGTR_PLAYLIST_Selected );
+  gtk_widget_ref( label5 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"label5",label5,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( label5 );
+  gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),0,label5 );
+  gtk_misc_set_alignment( GTK_MISC( label5 ),0.02,0.5 );
+
+  label5=gtk_label_new( MSGTR_PLAYLIST_Path );
+  gtk_widget_ref( label5 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"label5",label5,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( label5 );
+  gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),1,label5 );
+  gtk_misc_set_alignment( GTK_MISC( label5 ),0.02,0.5 );
 
-  Add = gtk_button_new_with_label( MSGTR_Add );
+  hseparator1=gtk_hseparator_new();
+  gtk_widget_ref( hseparator1 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hseparator1",hseparator1,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( hseparator1 );
+  gtk_box_pack_start( GTK_BOX( vbox1 ),hseparator1,FALSE,FALSE,0 );
+  gtk_widget_set_usize( hseparator1,-2,6 );
+
+  hbuttonbox1=gtk_hbutton_box_new();
+  gtk_widget_ref( hbuttonbox1 );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hbuttonbox1",hbuttonbox1,(GtkDestroyNotify)gtk_widget_unref );
+  gtk_widget_show( hbuttonbox1 );
+  gtk_box_pack_start( GTK_BOX( vbox1 ),hbuttonbox1,FALSE,FALSE,0 );
+  gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END );
+  gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 );
+  gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox1 ),-1,20 );
+  gtk_button_box_set_child_ipadding( GTK_BUTTON_BOX( hbuttonbox1 ),0,-1 );
+
+  Add=gtk_button_new_with_label( MSGTR_Add );
   gtk_widget_ref( Add );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),MSGTR_Add,Add,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"Add",Add,(GtkDestroyNotify)gtk_widget_unref );
   gtk_widget_show( Add );
-  gtk_container_add( GTK_CONTAINER( hbuttonbox5 ),Add );
-  gtk_widget_set_usize( Add,45,-2 );
-  GTK_WIDGET_SET_FLAGS( Add,GTK_CAN_DEFAULT );
+  gtk_container_add( GTK_CONTAINER( hbuttonbox1 ),Add );
+  GTK_WIDGET_UNSET_FLAGS( Add,GTK_CAN_FOCUS );
 
-  Remove = gtk_button_new_with_label( MSGTR_Remove );
+  Remove=gtk_button_new_with_label( MSGTR_Remove );
   gtk_widget_ref( Remove );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),MSGTR_Remove,Remove,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"Remove",Remove,(GtkDestroyNotify)gtk_widget_unref );
   gtk_widget_show( Remove );
-  gtk_container_add( GTK_CONTAINER( hbuttonbox5 ),Remove );
-  gtk_widget_set_usize( Remove,45,-2 );
-  GTK_WIDGET_SET_FLAGS( Remove,GTK_CAN_DEFAULT );
+  gtk_container_add( GTK_CONTAINER( hbuttonbox1 ),Remove );
+  GTK_WIDGET_UNSET_FLAGS( Remove,GTK_CAN_FOCUS );
 
-  Ok = gtk_button_new_with_label( MSGTR_Ok );
+  Ok=gtk_button_new_with_label( MSGTR_Ok );
   gtk_widget_ref( Ok );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),MSGTR_Ok,Ok,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"Ok",Ok,(GtkDestroyNotify)gtk_widget_unref );
   gtk_widget_show( Ok );
-  gtk_container_add( GTK_CONTAINER( hbuttonbox5 ),Ok );
-  gtk_widget_set_usize( Ok,45,-2 );
-  GTK_WIDGET_SET_FLAGS( Ok,GTK_CAN_DEFAULT );
+  gtk_container_add( GTK_CONTAINER( hbuttonbox1 ),Ok );
+  GTK_WIDGET_UNSET_FLAGS( Ok,GTK_CAN_FOCUS );
+//  gtk_widget_add_accelerator( Ok,"released",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
 
-  Cancel = gtk_button_new_with_label( MSGTR_Cancel );
+  Cancel=gtk_button_new_with_label( "Cancel" );
   gtk_widget_ref( Cancel );
-  gtk_object_set_data_full( GTK_OBJECT( PlayList ),MSGTR_Cancel,Cancel,
-                           ( GtkDestroyNotify ) gtk_widget_unref );
+  gtk_object_set_data_full( GTK_OBJECT( PlayList ),"Cancel",Cancel,(GtkDestroyNotify)gtk_widget_unref );
   gtk_widget_show( Cancel );
-  gtk_container_add( GTK_CONTAINER( hbuttonbox5 ),Cancel );
-  gtk_widget_set_usize( Cancel,45,-2 );
-  GTK_WIDGET_SET_FLAGS( Cancel,GTK_CAN_DEFAULT );
+  gtk_container_add( GTK_CONTAINER( hbuttonbox1 ),Cancel );
+  GTK_WIDGET_UNSET_FLAGS( Cancel,GTK_CAN_FOCUS );
+  gtk_widget_add_accelerator( Cancel,"released",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
 
-  gtk_signal_connect( GTK_OBJECT( PlayList ),"destroy",
-                      GTK_SIGNAL_FUNC( pl_PlayList_destroy ),
-                      NULL );
-  gtk_signal_connect( GTK_OBJECT( DirTree ),"select_child",
-                      GTK_SIGNAL_FUNC( pl_DirTree_select_child ),
-                      NULL );
-  gtk_signal_connect( GTK_OBJECT( DirTree ),"selection_changed",
-                      GTK_SIGNAL_FUNC( pl_DirTree_selection_changed ),
-                      NULL );
-  gtk_signal_connect( GTK_OBJECT( DirTree ),"unselect_child",
-                      GTK_SIGNAL_FUNC( pl_DirTree_unselect_child ),
-                      NULL );
-  gtk_signal_connect( GTK_OBJECT( FNameList ),"select_child",
-                      GTK_SIGNAL_FUNC( pl_FNameList_select_child ),
-                      NULL );
-  gtk_signal_connect( GTK_OBJECT( FNameList ),"selection_changed",
-                      GTK_SIGNAL_FUNC( pl_FNameList_selection_changed ),
-                      NULL );
-  gtk_signal_connect( GTK_OBJECT( FNameList ),"unselect_child",
-                      GTK_SIGNAL_FUNC( pl_FNameList_unselect_child ),
-                      NULL );
-  gtk_signal_connect( GTK_OBJECT( SelectedList ),"select_child",
-                      GTK_SIGNAL_FUNC( pl_SelectedList_select_child ),
-                      NULL );
-  gtk_signal_connect( GTK_OBJECT( SelectedList ),"selection_changed",
-                      GTK_SIGNAL_FUNC( pl_SelectedList_selection_changed ),
-                      NULL );
-  gtk_signal_connect( GTK_OBJECT( SelectedList ),"unselect_child",
-                      GTK_SIGNAL_FUNC( pl_SelectedList_unselect_child ),
-                      NULL );
-  gtk_signal_connect( GTK_OBJECT( Add ),"released",
-                      GTK_SIGNAL_FUNC( pl_Add_released ),
-                      NULL );
-  gtk_signal_connect( GTK_OBJECT( Remove ),"released",
-                      GTK_SIGNAL_FUNC( pl_Remove_released ),
-                      NULL );
-  gtk_signal_connect( GTK_OBJECT( Ok ),"released",
-                      GTK_SIGNAL_FUNC( pl_Ok_released ),
-                      NULL );
-  gtk_signal_connect( GTK_OBJECT( Cancel ),"released",
-                      GTK_SIGNAL_FUNC( pl_Cancel_released ),
-                      NULL );
+  gtk_signal_connect( GTK_OBJECT( PlayList ),"destroy",GTK_SIGNAL_FUNC( plDestroy ),NULL );
+  gtk_signal_connect( GTK_OBJECT( PlayList ),"show",GTK_SIGNAL_FUNC( plShow ),(void *)1 );
+  gtk_signal_connect( GTK_OBJECT( PlayList ),"hide",GTK_SIGNAL_FUNC( plShow ),(void *)0 );
+
+  gtk_signal_connect( GTK_OBJECT( CLFiles ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void *)0 );
+  gtk_signal_connect( GTK_OBJECT( CLFiles ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void *)0 );
+  sigSel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void*)1 );
+  sigUnsel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void*)1 );
+
+  gtk_signal_connect( GTK_OBJECT( Add ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)3 );
+  gtk_signal_connect( GTK_OBJECT( Remove ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)2 );
+  gtk_signal_connect( GTK_OBJECT( Ok ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)1 );
+  gtk_signal_connect( GTK_OBJECT( Cancel ),"released",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)0 );
+
+  gtk_window_add_accel_group( GTK_WINDOW( PlayList ),accel_group );
 
   return PlayList;
 }
--- a/Gui/mplayer/gtk/pl.h	Thu Jul 11 22:01:40 2002 +0000
+++ b/Gui/mplayer/gtk/pl.h	Fri Jul 12 00:53:26 2002 +0000
@@ -1,10 +1,14 @@
-#ifndef __GUI_PLAYLIST_H
-#define __GUI_PLAYLIST_H
+
+#ifndef __GUI_PL_H
+#define __GUI_PL_H
 
 #include <gtk/gtk.h>
 
-extern void HidePlayList( void );
-extern GtkWidget* create_PlayList( void );
+extern GtkWidget * PlayList;
 
-#endif
+extern void ShowPlayList( void );
+extern void HidePlayList( void );
 
+extern GtkWidget * create_PlayList (void);
+
+#endif
\ No newline at end of file
--- a/Gui/mplayer/mw.h	Thu Jul 11 22:01:40 2002 +0000
+++ b/Gui/mplayer/mw.h	Fri Jul 12 00:53:26 2002 +0000
@@ -254,12 +254,24 @@
    case evPlay:
    case evPlaySwitchToPause:
 play:
+
         mplMainAutoPlay=0;
         if ( ( msg == evPlaySwitchToPause )&&( guiIntfStruct.Playing == 1 ) ) goto NoPause;
 
 	vcd_track=0;
 	dvd_title=0;
 
+	if ( gtkSet( gtkGetCurrPlItem,0,NULL ) )
+	 {
+	  plItem * next = gtkSet( gtkGetCurrPlItem,0,NULL );
+	  plLastPlayed=next;
+	  guiSetDF( guiIntfStruct.Filename,next->path,next->name );
+	  guiIntfStruct.StreamType=STREAMTYPE_FILE;
+	  guiIntfStruct.FilenameChanged=1;
+	  if ( guiIntfStruct.AudioFile ) free( guiIntfStruct.AudioFile );
+	  guiIntfStruct.AudioFile=NULL;
+	 }
+
         switch ( guiIntfStruct.StreamType )
          {
 	  case STREAMTYPE_STREAM:
@@ -345,6 +357,7 @@
 //	guiIntfStruct.StreamType=STREAMTYPE_FILE;
    case evLoad:
         mplMainRender=1;
+	gtkSet( gtkDelPl,0,NULL );
         gtkShow( evLoad,NULL );
         break;
    case evLoadSubtitle:
@@ -363,15 +376,11 @@
         mplMainRender=1;
         break;
 
-   case evPlayList:
-        mplMainRender=1;
-        gtkShow( evPlayList,NULL );
-        break;
-
+   case evPlayList:    gtkShow( evPlayList,NULL );        break;
    case evSkinBrowser: gtkShow( evSkinBrowser,skinName ); break;
-   case evAbout:       gtkShow( evAbout,NULL ); break;
-   case evPreferences: gtkShow( evPreferences,NULL ); break;
-   case evEqualizer:   gtkShow( evEqualizer,NULL ); break;
+   case evAbout:       gtkShow( evAbout,NULL );           break;
+   case evPreferences: gtkShow( evPreferences,NULL );     break;
+   case evEqualizer:   gtkShow( evEqualizer,NULL );       break;
 
    case evForward1min:      mplRelSeek( 60 );  break;
    case evBackward1min:     mplRelSeek( -60 ); break;
--- a/Gui/mplayer/play.c	Thu Jul 11 22:01:40 2002 +0000
+++ b/Gui/mplayer/play.c	Fri Jul 12 00:53:26 2002 +0000
@@ -27,6 +27,8 @@
 extern float rel_seek_secs;
 extern int abs_seek_pos;
 
+static int mplGotoTheNext = 1;
+
 void mplFullScreen( void )
 {
  static int sx,sy;
@@ -83,13 +85,30 @@
 
 extern int mplSubRender;
 
-void mplStop()
+void mplEnd( void )
+{
+ plItem * next;
+
+ if ( !mplGotoTheNext ) { mplGotoTheNext=1; return; }
+
+ if ( (next=gtkSet( gtkGetNextPlItem,0,NULL )) && plLastPlayed != next )
+  {
+   plLastPlayed=next;
+   guiSetDF( guiIntfStruct.Filename,next->path,next->name );
+   guiIntfStruct.StreamType=STREAMTYPE_FILE;
+   guiIntfStruct.FilenameChanged=1;
+   if ( guiIntfStruct.AudioFile ) free( guiIntfStruct.AudioFile );
+   guiIntfStruct.AudioFile=NULL;
+  } else mplStop();
+}
+
+void mplStop( void )
 {
  guiIntfStruct.Playing=0;
  guiIntfStruct.TimeSec=0;
  guiIntfStruct.Position=0;
  guiIntfStruct.AudioType=0;
-// if ( !guiIntfStruct.Playing ) return;
+
  if ( !appMPlayer.subWindow.isFullScreen )
   {
    wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
@@ -229,7 +248,8 @@
 
 void mplPrev( void )
 {
- int stop = 0;
+ plItem * prev;
+ int      stop = 0;
  
  if ( guiIntfStruct.Playing == 2 ) return;
  switch ( guiIntfStruct.StreamType )
@@ -249,7 +269,14 @@
 	if ( --guiIntfStruct.Track == 0 ) { guiIntfStruct.Track=1; stop=1; }
 	break;
 #endif
-   default: return;
+   default: 
+	if ( (prev=gtkSet( gtkGetPrevPlItem,0,NULL)) ) { mplGotoTheNext=0; break; }
+//	 {
+//	  guiSetDF( guiIntfStruct.Filename,prev->path,prev->name );
+//	  guiIntfStruct.FilenameChanged=1;
+//	  break;
+//	 }
+	return;
   }
  if ( stop ) mplEventHandling( evStop,0 );
  if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
@@ -257,7 +284,8 @@
 
 void mplNext( void )
 {
- int stop = 0;
+ int      stop = 0;
+ plItem * next;
 
  if ( guiIntfStruct.Playing == 2 ) return;
  switch ( guiIntfStruct.StreamType )
@@ -277,7 +305,14 @@
 	if ( ++guiIntfStruct.Track > guiIntfStruct.VCDTracks ) { guiIntfStruct.Track=guiIntfStruct.VCDTracks; stop=1; }
 	break;
 #endif
-   default: return;
+   default:
+	if ( (next=gtkSet( gtkGetNextPlItem,0,NULL)) ) { mplGotoTheNext=0; break; }
+//	 {
+//	  guiSetDF( guiIntfStruct.Filename,next->path,next->name );
+//	  guiIntfStruct.FilenameChanged=1;
+//	  break;
+//	 }
+	return;
   }
  if ( stop ) mplEventHandling( evStop,0 );
  if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
--- a/Gui/mplayer/play.h	Thu Jul 11 22:01:40 2002 +0000
+++ b/Gui/mplayer/play.h	Fri Jul 12 00:53:26 2002 +0000
@@ -6,7 +6,8 @@
 
 #include "./mplayer.h"
 
-extern void mplStop();
+extern void mplEnd( void );
+extern void mplStop( void );
 extern void mplFullScreen( void );
 extern void mplPlay( void );
 extern void mplPause( void );
--- a/Gui/mplayer/widgets.c	Thu Jul 11 22:01:40 2002 +0000
+++ b/Gui/mplayer/widgets.c	Fri Jul 12 00:53:26 2002 +0000
@@ -30,7 +30,6 @@
 #include "../../config.h"
 #include "../../help_mp.h"
 
-GtkWidget     * PlayList;
 GtkWidget     * Options;
 GtkWidget     * PopUpMenu = NULL;
 
@@ -192,10 +191,9 @@
 //	gtkSetLayer( Options );
         break;
    case evPlayList:
-        gtkMessageBox( GTK_MB_WARNING,"Sorry, this feature is under development ..." );
-//	PlayList=create_PlayList();
-//        gtk_widget_show( PlayList );
-//	gtkSetLayer( PlayList );
+//	gtkMessageBox( GTK_MB_WARNING,"Sorry, this feature is under development ..." );
+        ShowPlayList();
+	gtkSetLayer( PlayList );
         break;
    case evLoad:
         ShowFileSelect( fsVideoSelector,0 );
--- a/help_mp-en.h	Thu Jul 11 22:01:40 2002 +0000
+++ b/help_mp-en.h	Fri Jul 12 00:53:26 2002 +0000
@@ -330,6 +330,12 @@
 #define MSGTR_EQU_Bass "Bass"
 #define MSGTR_EQU_All "All"
 
+// --- playlist
+#define MSGTR_PLAYLIST_Path "Path"
+#define MSGTR_PLAYLIST_Selected "Selected files"
+#define MSGTR_PLAYLIST_Files "Files"
+#define MSGTR_PLAYLIST_DirectoryTree "Directory tree"
+
 // --- messagebox
 #define MSGTR_MSGBOX_LABEL_FatalError "fatal error ..."
 #define MSGTR_MSGBOX_LABEL_Error "error ..."
--- a/help_mp-hu.h	Thu Jul 11 22:01:40 2002 +0000
+++ b/help_mp-hu.h	Fri Jul 12 00:53:26 2002 +0000
@@ -325,6 +325,12 @@
 #define MSGTR_EQU_Bass "Basszus"
 #define MSGTR_EQU_All "Mindegyik"
 
+// --- playlist
+#define MSGTR_PLAYLIST_Path "Utvonal"
+#define MSGTR_PLAYLIST_Selected "Kiv'lasztott filr - ok"
+#define MSGTR_PLAYLIST_Files "File - ok"
+#define MSGTR_PLAYLIST_DirectoryTree "Könyvtár lista"
+
 // --- messagebox
 #define MSGTR_MSGBOX_LABEL_FatalError "végzetes hiba ..."
 #define MSGTR_MSGBOX_LABEL_Error "hiba ..."
--- a/mplayer.c	Thu Jul 11 22:01:40 2002 +0000
+++ b/mplayer.c	Fri Jul 12 00:53:26 2002 +0000
@@ -2895,7 +2895,7 @@
 	guiGetEvent( guiReDraw,NULL );
 	if(guiIntfStruct.Playing==0) break; // STOP
 	if(guiIntfStruct.Playing==2) osd_function=OSD_PAUSE;
-        if ( guiIntfStruct.DiskChanged ) goto goto_next_file;
+        if ( guiIntfStruct.DiskChanged || guiIntfStruct.FilenameChanged ) goto goto_next_file;
 #ifdef USE_DVDREAD
         if ( stream->type == STREAMTYPE_DVD )
 	 {
@@ -3077,7 +3077,7 @@
 #ifdef USE_DVDREAD
    if ( !guiIntfStruct.DiskChanged ) 
 #endif
-   mplStop();
+   mplEnd();
   }	
 #endif