[MPlayer-cvslog] r34752 - in trunk/gui: interface.c ui/gtk/playlist.c util/list.c util/list.h

ib subversion at mplayerhq.hu
Tue Feb 21 20:44:22 CET 2012


Author: ib
Date: Tue Feb 21 20:44:21 2012
New Revision: 34752

Log:
Remove global variable pointing to current playlist item.

Instead, use the listMgr command to get it.

Modified:
   trunk/gui/interface.c
   trunk/gui/ui/gtk/playlist.c
   trunk/gui/util/list.c
   trunk/gui/util/list.h

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Tue Feb 21 19:55:14 2012	(r34751)
+++ trunk/gui/interface.c	Tue Feb 21 20:44:21 2012	(r34752)
@@ -68,6 +68,7 @@ static int initialized;
 void guiInit(void)
 {
     int i;
+    plItem *playlist;
 
     mp_msg(MSGT_GPLAYER, MSGL_V, "GUI init.\n");
 
@@ -233,8 +234,10 @@ void guiInit(void)
 
     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
     }
 

Modified: trunk/gui/ui/gtk/playlist.c
==============================================================================
--- trunk/gui/ui/gtk/playlist.c	Tue Feb 21 19:55:14 2012	(r34751)
+++ trunk/gui/ui/gtk/playlist.c	Tue Feb 21 20:44:21 2012	(r34752)
@@ -191,10 +191,10 @@ static void plButtonReleased( GtkButton 
   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 @@ static void plButtonReleased( GtkButton 
 	  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;
 	 }

Modified: trunk/gui/util/list.c
==============================================================================
--- trunk/gui/util/list.c	Tue Feb 21 19:55:14 2012	(r34751)
+++ trunk/gui/util/list.c	Tue Feb 21 20:44:21 2012	(r34752)
@@ -23,7 +23,7 @@
 #include "string.h"
 
 plItem *plList;
-plItem *plCurrent;
+static plItem *plCurrent;
 plItem *plLastPlayed;
 
 urlItem *urlList;

Modified: trunk/gui/util/list.h
==============================================================================
--- trunk/gui/util/list.h	Tue Feb 21 19:55:14 2012	(r34751)
+++ trunk/gui/util/list.h	Tue Feb 21 20:44:21 2012	(r34752)
@@ -45,7 +45,6 @@ typedef struct urlItem {
 } urlItem;
 
 extern plItem *plList;
-extern plItem *plCurrent;
 extern plItem *plLastPlayed;
 
 extern urlItem *urlList;


More information about the MPlayer-cvslog mailing list