changeset 35389:a54338c73df8

Simplify playlist handling by defining a symbolic constant. This should make the code also easier to read.
author ib
date Mon, 26 Nov 2012 10:48:26 +0000
parents 6c9c58ad43a3
children 0c63a0f2e991
files gui/interface.c gui/interface.h gui/ui/main.c
diffstat 3 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Sun Nov 25 22:56:28 2012 +0000
+++ b/gui/interface.c	Mon Nov 26 10:48:26 2012 +0000
@@ -789,9 +789,7 @@
 
             filename = NULL;
 
-            if (!listMgr(PLAYLIST_ITEM_GET_CURR, 0) &&
-                (guiInfo.StreamType == STREAMTYPE_FILE ||
-                 guiInfo.StreamType == STREAMTYPE_STREAM))
+            if (isPlaylistStreamtype && !listMgr(PLAYLIST_ITEM_GET_CURR, 0))
                 uiSetFileName(NULL, NULL, STREAMTYPE_DUMMY);
 
             guiInfo.ElapsedTime   = 0;
--- a/gui/interface.h	Sun Nov 25 22:56:28 2012 +0000
+++ b/gui/interface.h	Mon Nov 26 10:48:26 2012 +0000
@@ -69,6 +69,9 @@
 #define GUI_FILE_NEW  2
 //@}
 
+/// StreamTypes that are permitted in a playlist
+#define isPlaylistStreamtype (guiInfo.StreamType == STREAMTYPE_FILE || guiInfo.StreamType == STREAMTYPE_STREAM)
+
 /// mplayer() instructions
 enum {
     MPLAYER_EXIT_GUI,
--- a/gui/ui/main.c	Sun Nov 25 22:56:28 2012 +0000
+++ b/gui/ui/main.c	Mon Nov 26 10:48:26 2012 +0000
@@ -208,7 +208,7 @@
 
         if ( ( msg == evPlaySwitchToPause )&&( guiInfo.Playing == GUI_PAUSE ) ) goto NoPause;
 
-	if ( listMgr( PLAYLIST_ITEM_GET_CURR,0 ) &&( guiInfo.StreamType == STREAMTYPE_FILE || guiInfo.StreamType == STREAMTYPE_STREAM ) )
+	if ( isPlaylistStreamtype && listMgr( PLAYLIST_ITEM_GET_CURR,0 ) )
 	 {
 	  plItem * curr = listMgr( PLAYLIST_ITEM_GET_CURR,0 );
 	  uiSetFileName( curr->path,curr->name,SAME_STREAMTYPE );