changeset 34667:7c447e9db447

Remove global variable pointing to top of playlist. Add a corresponding listMgr command and use it instead.
author ib
date Wed, 22 Feb 2012 10:39:05 +0000
parents a5c69b91ff2c
children 00e8aecfa7ff
files gui/cfg.c gui/interface.c gui/ui/gtk/playlist.c gui/util/list.c gui/util/list.h
diffstat 5 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/gui/cfg.c	Wed Feb 22 01:07:10 2012 +0000
+++ b/gui/cfg.c	Wed Feb 22 10:39:05 2012 +0000
@@ -394,7 +394,7 @@
     file  = fopen(fname, "wt+");
 
     if (file) {
-        plItem *item = plList;
+        plItem *item = listMgr(PLAYLIST_GET, 0);
 
         while (item) {
             if (item->path && item->name) {
--- a/gui/interface.c	Wed Feb 22 01:07:10 2012 +0000
+++ b/gui/interface.c	Wed Feb 22 10:39:05 2012 +0000
@@ -913,7 +913,7 @@
     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);
--- a/gui/ui/gtk/playlist.c	Wed Feb 22 01:07:10 2012 +0000
+++ b/gui/ui/gtk/playlist.c	Wed Feb 22 10:39:05 2012 +0000
@@ -89,6 +89,8 @@
 
 void ShowPlayList( void )
 {
+ plItem * next;
+
  if ( PlayList ) gtkActive( PlayList );
   else PlayList=create_PlayList();
 
@@ -130,10 +132,10 @@
 
  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]="";
--- a/gui/util/list.c	Wed Feb 22 01:07:10 2012 +0000
+++ b/gui/util/list.c	Wed Feb 22 10:39:05 2012 +0000
@@ -22,7 +22,7 @@
 #include "list.h"
 #include "string.h"
 
-plItem *plList;
+static plItem *plList;
 static plItem *plCurrent;
 plItem *plLastPlayed;
 
@@ -37,6 +37,10 @@
     switch (cmd) {
     // handle playlist
 
+    case PLAYLIST_GET:
+
+        return plList;
+
     // add item to playlist
     case PLAYLIST_ITEM_ADD:
         if (plList) {
--- a/gui/util/list.h	Wed Feb 22 01:07:10 2012 +0000
+++ b/gui/util/list.h	Wed Feb 22 10:39:05 2012 +0000
@@ -21,6 +21,7 @@
 
 /// listMgr() commands
 enum {
+    PLAYLIST_GET,
     PLAYLIST_ITEM_ADD,
     PLAYLIST_ITEM_INSERT,
     PLAYLIST_ITEM_SET_CURR,
@@ -44,7 +45,6 @@
     struct urlItem *next;
 } urlItem;
 
-extern plItem *plList;
 extern plItem *plLastPlayed;
 
 extern urlItem *urlList;