comparison 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
comparison
equal deleted inserted replaced
35375:15b6ae10180a 35376:02006c5b3b30
457 setddup(&guiInfo.Filename, dir, name); 457 setddup(&guiInfo.Filename, dir, name);
458 458
459 filename = guiInfo.Filename; 459 filename = guiInfo.Filename;
460 #ifdef __WINE__ 460 #ifdef __WINE__
461 // When the GUI receives the files to be played in guiPlaylistInitialize() 461 // When the GUI receives the files to be played in guiPlaylistInitialize()
462 // and guiPlaylistAdd(), it calls add_to_gui_playlist() where the call of 462 // and guiPlaylistAdd(), it calls import_file_into_gui() where the call of
463 // Wine's GetFullPathName() converts each file name into the Windows style 463 // Wine's GetFullPathName() converts each file name into the Windows style
464 // (C:\path\to\file), which needs to be reconverted for MPlayer, so that 464 // (C:\path\to\file), which needs to be reconverted for MPlayer, so that
465 // it will find the filename in the Linux filesystem. 465 // it will find the filename in the Linux filesystem.
466 filename = unix_name(filename); 466 filename = unix_name(filename);
467 #endif 467 #endif
815 } 815 }
816 return 1; 816 return 1;
817 } 817 }
818 818
819 /* This function adds/inserts one file into the gui playlist */ 819 /* This function adds/inserts one file into the gui playlist */
820 int add_to_gui_playlist(const char *what, int how) 820 static int import_file_into_gui(char *pathname, int insert)
821 { 821 {
822 char filename[MAX_PATH]; 822 char filename[MAX_PATH];
823 char *filepart = filename; 823 char *filepart = filename;
824 824
825 if (strstr(what, "://")) 825 if (strstr(pathname, "://"))
826 { 826 {
827 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding special %s\n", what); 827 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding special %s\n", pathname);
828 mygui->playlist->add_track(mygui->playlist, what, NULL, NULL, 0); 828 mygui->playlist->add_track(mygui->playlist, pathname, NULL, NULL, 0);
829 return 1; 829 return 1;
830 } 830 }
831 if (GetFullPathName(what, MAX_PATH, filename, &filepart)) 831 if (GetFullPathName(pathname, MAX_PATH, filename, &filepart))
832 { 832 {
833 if (!(GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY)) 833 if (!(GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY))
834 { 834 {
835 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding filename: %s - fullpath: %s\n", filepart, filename); 835 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding filename: %s - fullpath: %s\n", filepart, filename);
836 mygui->playlist->add_track(mygui->playlist, filename, NULL, filepart, 0); 836 mygui->playlist->add_track(mygui->playlist, filename, NULL, filepart, 0);
858 { 858 {
859 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL) 859 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
860 { 860 {
861 if (parse_filename(filename, my_playtree, config, 0)) 861 if (parse_filename(filename, my_playtree, config, 0))
862 result = 1; 862 result = 1;
863 else if (add_to_gui_playlist(filename, PLAYLIST_ITEM_APPEND)) /* Add it to end of list */ 863 else if (import_file_into_gui(filename, 0)) /* Add it to end of list */
864 result = 1; 864 result = 1;
865 } 865 }
866 } 866 }
867 uiProcessNextInPlaylist = 1; 867 uiProcessNextInPlaylist = 1;
868 868
887 int result = 0; 887 int result = 0;
888 888
889 if((my_pt_iter = pt_iter_create(&my_playtree, config))) 889 if((my_pt_iter = pt_iter_create(&my_playtree, config)))
890 { 890 {
891 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL) 891 while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
892 if (add_to_gui_playlist(filename, PLAYLIST_ITEM_INSERT)) /* insert it into the list and set plCurrent = new item */ 892 if (import_file_into_gui(filename, 1)) /* insert it into the list and set plCurrent = new item */
893 result = 1; 893 result = 1;
894 pt_iter_destroy(&my_pt_iter); 894 pt_iter_destroy(&my_pt_iter);
895 } 895 }
896 return result; 896 return result;
897 } 897 }