diff gui/win32/interface.c @ 35376:02006c5b3b30

Move add_to_gui_playlist() to util/list.c. It's not an interface related function, but a playlist utility one. Additionally, add doxygen comments and change debug message. As a result, the different implementation of add_to_gui_playlist() of the Win32 GUI - the GUI uses code from util/list.c - can't have the same name and thus will be renamed to import_file_into_gui() again, reverting the r35467 and r35444 changes which were premature.
author ib
date Sun, 25 Nov 2012 11:51:35 +0000
parents 8249c2131cd3
children 2d55540614a9
line wrap: on
line diff
--- a/gui/win32/interface.c	Sun Nov 25 11:37:52 2012 +0000
+++ b/gui/win32/interface.c	Sun Nov 25 11:51:35 2012 +0000
@@ -459,7 +459,7 @@
     filename = guiInfo.Filename;
 #ifdef __WINE__
     // When the GUI receives the files to be played in guiPlaylistInitialize()
-    // and guiPlaylistAdd(), it calls add_to_gui_playlist() where the call of
+    // and guiPlaylistAdd(), it calls import_file_into_gui() where the call of
     // Wine's GetFullPathName() converts each file name into the Windows style
     // (C:\path\to\file), which needs to be reconverted for MPlayer, so that
     // it will find the filename in the Linux filesystem.
@@ -817,18 +817,18 @@
 }
 
 /* This function adds/inserts one file into the gui playlist */
-int add_to_gui_playlist(const char *what, int how)
+static int import_file_into_gui(char *pathname, int insert)
 {
     char filename[MAX_PATH];
     char *filepart = filename;
 
-    if (strstr(what, "://"))
+    if (strstr(pathname, "://"))
     {
-        mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding special %s\n", what);
-        mygui->playlist->add_track(mygui->playlist, what, NULL, NULL, 0);
+        mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding special %s\n", pathname);
+        mygui->playlist->add_track(mygui->playlist, pathname, NULL, NULL, 0);
         return 1;
     }
-    if (GetFullPathName(what, MAX_PATH, filename, &filepart))
+    if (GetFullPathName(pathname, MAX_PATH, filename, &filepart))
     {
         if (!(GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY))
         {
@@ -860,7 +860,7 @@
         {
             if (parse_filename(filename, my_playtree, config, 0))
                 result = 1;
-            else if (add_to_gui_playlist(filename, PLAYLIST_ITEM_APPEND)) /* Add it to end of list */
+            else if (import_file_into_gui(filename, 0)) /* Add it to end of list */
                 result = 1;
         }
     }
@@ -889,7 +889,7 @@
     if((my_pt_iter = pt_iter_create(&my_playtree, config)))
     {
         while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
-            if (add_to_gui_playlist(filename, PLAYLIST_ITEM_INSERT)) /* insert it into the list and set plCurrent = new item */
+            if (import_file_into_gui(filename, 1)) /* insert it into the list and set plCurrent = new item */
                 result = 1;
         pt_iter_destroy(&my_pt_iter);
     }