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

ib subversion at mplayerhq.hu
Wed Feb 22 11:39:05 CET 2012


Author: ib
Date: Wed Feb 22 11:39:05 2012
New Revision: 34755

Log:
Remove global variable pointing to top of playlist.

Add a corresponding listMgr command and use it instead.

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

Modified: trunk/gui/cfg.c
==============================================================================
--- trunk/gui/cfg.c	Wed Feb 22 02:07:10 2012	(r34754)
+++ trunk/gui/cfg.c	Wed Feb 22 11:39:05 2012	(r34755)
@@ -394,7 +394,7 @@ void cfg_write(void)
     file  = fopen(fname, "wt+");
 
     if (file) {
-        plItem *item = plList;
+        plItem *item = listMgr(PLAYLIST_GET, 0);
 
         while (item) {
             if (item->path && item->name) {

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Wed Feb 22 02:07:10 2012	(r34754)
+++ trunk/gui/interface.c	Wed Feb 22 11:39:05 2012	(r34755)
@@ -913,7 +913,7 @@ int guiPlaylistAdd(play_tree_t *my_playt
     if (save)
         listMgr(PLAYLIST_ITEM_SET_CURR, save);
     else
-        listMgr(PLAYLIST_ITEM_SET_CURR, plList);    // go to head, if plList was empty before
+        listMgr(PLAYLIST_ITEM_SET_CURR, listMgr(PLAYLIST_GET, 0));    // go to head, if plList was empty before
 
     if (save && result)
         listMgr(PLAYLIST_ITEM_DEL_CURR, 0);

Modified: trunk/gui/ui/gtk/playlist.c
==============================================================================
--- trunk/gui/ui/gtk/playlist.c	Wed Feb 22 02:07:10 2012	(r34754)
+++ trunk/gui/ui/gtk/playlist.c	Wed Feb 22 11:39:05 2012	(r34755)
@@ -89,6 +89,8 @@ static void scan_dir( char * path );
 
 void ShowPlayList( void )
 {
+ plItem * next;
+
  if ( PlayList ) gtkActive( PlayList );
   else PlayList=create_PlayList();
 
@@ -130,10 +132,10 @@ void ShowPlayList( void )
 
  gtk_clist_freeze( GTK_CLIST( CLSelected ) );
  gtk_clist_clear( GTK_CLIST( CLSelected ) );
- if ( plList )
+ next = listMgr( PLAYLIST_GET,0 );
+ if ( next )
   {
    gchar * name, * path;
-   plItem * next = plList;
    while ( next || next->next )
     {
      char * text[1][3]; text[0][2]="";

Modified: trunk/gui/util/list.c
==============================================================================
--- trunk/gui/util/list.c	Wed Feb 22 02:07:10 2012	(r34754)
+++ trunk/gui/util/list.c	Wed Feb 22 11:39:05 2012	(r34755)
@@ -22,7 +22,7 @@
 #include "list.h"
 #include "string.h"
 
-plItem *plList;
+static plItem *plList;
 static plItem *plCurrent;
 plItem *plLastPlayed;
 
@@ -37,6 +37,10 @@ void *listMgr(int cmd, void *data)
     switch (cmd) {
     // handle playlist
 
+    case PLAYLIST_GET:
+
+        return plList;
+
     // add item to playlist
     case PLAYLIST_ITEM_ADD:
         if (plList) {

Modified: trunk/gui/util/list.h
==============================================================================
--- trunk/gui/util/list.h	Wed Feb 22 02:07:10 2012	(r34754)
+++ trunk/gui/util/list.h	Wed Feb 22 11:39:05 2012	(r34755)
@@ -21,6 +21,7 @@
 
 /// listMgr() commands
 enum {
+    PLAYLIST_GET,
     PLAYLIST_ITEM_ADD,
     PLAYLIST_ITEM_INSERT,
     PLAYLIST_ITEM_SET_CURR,
@@ -44,7 +45,6 @@ typedef struct urlItem {
     struct urlItem *next;
 } urlItem;
 
-extern plItem *plList;
 extern plItem *plLastPlayed;
 
 extern urlItem *urlList;


More information about the MPlayer-cvslog mailing list