Mercurial > mplayer.hg
comparison Gui/mplayer/mw.h @ 6977:7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
author | pontscho |
---|---|
date | Sun, 11 Aug 2002 19:12:09 +0000 |
parents | 0fa27966ac47 |
children | 163f78ece9c2 |
comparison
equal
deleted
inserted
replaced
6976:23c3cd12abe5 | 6977:7242f1840f8d |
---|---|
663 /* clear playlist */ | 663 /* clear playlist */ |
664 gtkSet(gtkDelPl,0,NULL); | 664 gtkSet(gtkDelPl,0,NULL); |
665 | 665 |
666 /* now fill it with new items */ | 666 /* now fill it with new items */ |
667 for(f=0; f < num; f++){ | 667 for(f=0; f < num; f++){ |
668 char* str = files[f]; | 668 char* str = strdup( files[f] ); |
669 plItem* item; | 669 plItem* item; |
670 | |
671 if ( strchr( str,'%' ) ) | |
672 { | |
673 char * t = calloc( 1,strlen( str ) ); | |
674 int i,c = 0; | |
675 for ( i=0;i < strlen( str );i++ ) | |
676 if ( str[i] != '%' ) t[c++]=str[i]; | |
677 else | |
678 { | |
679 char tmp[4] = "0xXX"; | |
680 // if ( str[++i] == '%' ) { t[c++]='%'; continue; }; | |
681 tmp[2]=str[++i]; tmp[3]=str[++i]; t[c++]=(char)strtol( tmp,(char **)NULL,16 ); | |
682 } | |
683 free( str ); str=t; | |
684 } | |
685 | |
670 if(stat(str,&buf) == 0 && S_ISDIR(buf.st_mode) == 0) { | 686 if(stat(str,&buf) == 0 && S_ISDIR(buf.st_mode) == 0) { |
671 /* this is not a directory so try to play it */ | 687 /* this is not a directory so try to play it */ |
672 printf("Received D&D %s\n",str); | 688 printf("Received D&D %s\n",str); |
673 item = calloc(1,sizeof(plItem)); | 689 item = calloc(1,sizeof(plItem)); |
690 | |
674 /* FIXME: decompose file name ? */ | 691 /* FIXME: decompose file name ? */ |
675 /* yes -- Pontscho */ | 692 /* yes -- Pontscho */ |
676 if ( strrchr( str,'/' ) ) | 693 if ( strrchr( str,'/' ) ) |
677 { | 694 { |
678 char * t = strdup( str ); | 695 char * s = strrchr( str,'/' ); *s=0; s++; |
679 char * s = strrchr( t,'/' ); *s=0; s++; | |
680 item->name = gstrdup( s ); | 696 item->name = gstrdup( s ); |
681 item->path = gstrdup( t ); | 697 item->path = gstrdup( str ); |
682 free( t ); | |
683 } else { item->name = strdup(str); item->path = strdup(""); } | 698 } else { item->name = strdup(str); item->path = strdup(""); } |
684 gtkSet(gtkAddPlItem,0,(void*)item); | 699 gtkSet(gtkAddPlItem,0,(void*)item); |
685 } else { | 700 } else { |
686 printf("Received not a file: %s !\n",str); | 701 printf("Received not a file: %s !\n",str); |
687 } | 702 } |
703 free( str ); | |
688 } | 704 } |
689 | 705 |
690 mplSetFileName( NULL,files[0] ); | 706 mplSetFileName( NULL,files[0] ); |
691 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evStop,0 ); | 707 if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evStop,0 ); |
692 mplEventHandling( evPlay,0 ); | 708 mplEventHandling( evPlay,0 ); |