changeset 34668:00e8aecfa7ff

Remove global variable pointing to top of URL list. Add a corresponding listMgr command and use it instead.
author ib
date Wed, 22 Feb 2012 10:53:00 +0000
parents 7c447e9db447
children 697aaedfe59e
files gui/cfg.c gui/ui/gtk/url.c gui/util/list.c gui/util/list.h
diffstat 4 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/gui/cfg.c	Wed Feb 22 10:39:05 2012 +0000
+++ b/gui/cfg.c	Wed Feb 22 10:53:00 2012 +0000
@@ -416,7 +416,7 @@
     file  = fopen(fname, "wt+");
 
     if (file) {
-        urlItem *item = urlList;
+        urlItem *item = listMgr(URLLIST_GET, 0);
 
         while (item) {
             if (item->url)
--- a/gui/ui/gtk/url.c	Wed Feb 22 10:39:05 2012 +0000
+++ b/gui/ui/gtk/url.c	Wed Feb 22 10:53:00 2012 +0000
@@ -44,12 +44,15 @@
 
 void ShowURLDialogBox( void )
 {
+ urlItem * item;
+
  if ( URL ) gtkActive( URL );
    else URL=create_URL();
 
- if ( urlList )
+ item = listMgr( URLLIST_GET,0 );
+
+ if ( item )
   {
-   urlItem * item = urlList;
    g_list_free( URLComboEntrys );
    URLComboEntrys=NULL;
    while( item )
--- a/gui/util/list.c	Wed Feb 22 10:39:05 2012 +0000
+++ b/gui/util/list.c	Wed Feb 22 10:53:00 2012 +0000
@@ -26,7 +26,7 @@
 static plItem *plCurrent;
 plItem *plLastPlayed;
 
-urlItem *urlList;
+static urlItem *urlList;
 
 void *listMgr(int cmd, void *data)
 {
@@ -156,6 +156,11 @@
         return NULL;
 
     // handle url
+
+    case URLLIST_GET:
+
+        return urlList;
+
     case URLLIST_ITEM_ADD:
         if (urlList) {
             urlItem *next_url = urlList;
--- a/gui/util/list.h	Wed Feb 22 10:39:05 2012 +0000
+++ b/gui/util/list.h	Wed Feb 22 10:53:00 2012 +0000
@@ -30,6 +30,7 @@
     PLAYLIST_ITEM_GET_NEXT,
     PLAYLIST_ITEM_DEL_CURR,
     PLAYLIST_DELETE,
+    URLLIST_GET,
     URLLIST_ITEM_ADD,
     URLLIST_DELETE
 };
@@ -47,8 +48,6 @@
 
 extern plItem *plLastPlayed;
 
-extern urlItem *urlList;
-
 /// @name list manager (playlist, URL list)
 void *listMgr(int cmd, void *data);