diff gui/interface.c @ 35510:06aa6dc71613

Combine guiPlaylistInitialize() and guiPlaylistAdd(). New guiPlaylist() handles both now according to the instruction passed to it.
author ib
date Wed, 05 Dec 2012 11:51:08 +0000
parents ff7cf8f1bd19
children 6616645f91ea
line wrap: on
line diff
--- a/gui/interface.c	Wed Dec 05 08:35:23 2012 +0000
+++ b/gui/interface.c	Wed Dec 05 11:51:08 2012 +0000
@@ -853,14 +853,18 @@
     return True;
 }
 
+int guiPlaylist(int what, play_tree_t *my_playtree, m_config_t *config, int enqueue)
+{
+    play_tree_iter_t *my_pt_iter = NULL;
+    int added = False;
+    plItem *save;
+
+    switch (what) {
 // This function imports the initial playtree (based on cmd-line files)
 // into the gui playlist by either:
 // - overwriting gui pl (enqueue=0)
 // - appending it to gui pl (enqueue=1)
-int guiPlaylistInitialize(play_tree_t *my_playtree, m_config_t *config, int enqueue)
-{
-    play_tree_iter_t *my_pt_iter = NULL;
-    int added = False;
+    case GUI_PLAYLIST_INIT:
 
     if (!enqueue)
         listMgr(PLAYLIST_DELETE, 0);             // delete playlist before "appending"
@@ -881,19 +885,14 @@
     if (added)
         guiInfo.Track = 1;
 
-    return added;
-}
+        break;
 
 // This function imports and inserts an playtree, that is created "on the fly",
 // for example by parsing some MOV-Reference-File; or by loading an playlist
 // with "File Open". (The latter, actually, isn't allowed in MPlayer and thus
 // not working which is why this function won't get called for that reason.)
 // The file which contained the playlist is thereby replaced with it's contents.
-int guiPlaylistAdd(play_tree_t *my_playtree, m_config_t *config)
-{
-    play_tree_iter_t *my_pt_iter = NULL;
-    int added = False;
-    plItem *save;
+    case GUI_PLAYLIST_ADD:
 
     save = (plItem *)listMgr(PLAYLIST_ITEM_GET_CURR, 0);    // save current item
 
@@ -916,6 +915,9 @@
 
     uiCurr();   // update filename
 
+        break;
+    }
+
     return added;
 }