changeset 34664:4df4d842d5fb

Remove global variable pointing to current playlist item. Instead, use the listMgr command to get it.
author ib
date Tue, 21 Feb 2012 19:44:21 +0000
parents 73a5ecb53ee2
children ca53dc5326fa
files gui/interface.c gui/ui/gtk/playlist.c gui/util/list.c gui/util/list.h
diffstat 4 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Tue Feb 21 18:55:14 2012 +0000
+++ b/gui/interface.c	Tue Feb 21 19:44:21 2012 +0000
@@ -68,6 +68,7 @@
 void guiInit(void)
 {
     int i;
+    plItem *playlist;
 
     mp_msg(MSGT_GPLAYER, MSGL_V, "GUI init.\n");
 
@@ -233,8 +234,10 @@
 
     uiSubRender = 1;
 
-    if (plCurrent && !filename) {
-        uiSetFileName(plCurrent->path, plCurrent->name, STREAMTYPE_FILE);
+    playlist = listMgr(PLAYLIST_ITEM_GET_CURR, 0);
+
+    if (playlist && !filename) {
+        uiSetFileName(playlist->path, playlist->name, STREAMTYPE_FILE);
         filename = NULL; // don't start playing
     }
 
--- a/gui/ui/gtk/playlist.c	Tue Feb 21 18:55:14 2012 +0000
+++ b/gui/ui/gtk/playlist.c	Tue Feb 21 19:44:21 2012 +0000
@@ -191,10 +191,10 @@
   case 1: // ok
        {
         int i;
+        plItem * item;
 	if ( plList ) listMgr( PLAYLIST_DELETE,0 );
 	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] );
@@ -205,10 +205,11 @@
 	  if ( !item->path ) item->path = strdup( text[1] );
 	  listMgr( PLAYLIST_ITEM_ADD,item );
 	 }
-	if ( plCurrent )
+	item = listMgr( PLAYLIST_ITEM_GET_CURR,0 );
+	if ( item )
 	 {
-	  uiSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE );
-//	  setddup( &guiInfo.Filename,plCurrent->path,plCurrent->name );
+	  uiSetFileName( item->path,item->name,STREAMTYPE_FILE );
+//	  setddup( &guiInfo.Filename,item->path,item->name );
 //	  guiInfo.NewPlay=GUI_FILE_NEW;
 //	  guiInfo.StreamType=STREAMTYPE_FILE;
 	 }
--- a/gui/util/list.c	Tue Feb 21 18:55:14 2012 +0000
+++ b/gui/util/list.c	Tue Feb 21 19:44:21 2012 +0000
@@ -23,7 +23,7 @@
 #include "string.h"
 
 plItem *plList;
-plItem *plCurrent;
+static plItem *plCurrent;
 plItem *plLastPlayed;
 
 urlItem *urlList;
--- a/gui/util/list.h	Tue Feb 21 18:55:14 2012 +0000
+++ b/gui/util/list.h	Tue Feb 21 19:44:21 2012 +0000
@@ -45,7 +45,6 @@
 } urlItem;
 
 extern plItem *plList;
-extern plItem *plCurrent;
 extern plItem *plLastPlayed;
 
 extern urlItem *urlList;