diff options
author | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-08-11 19:12:09 +0000 |
---|---|---|
committer | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-08-11 19:12:09 +0000 |
commit | afdbb16a2f91f7b0ea7f6b53522e2447407d6917 (patch) | |
tree | d03407065e9a579f0cde9899b7b83ade4530c862 /Gui/mplayer | |
parent | 98c903c162d6b7e12daff0d0fbfef10b986f9d2f (diff) |
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6978 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'Gui/mplayer')
-rw-r--r-- | Gui/mplayer/mw.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/Gui/mplayer/mw.h b/Gui/mplayer/mw.h index bf86bd8edd..8cc410403e 100644 --- a/Gui/mplayer/mw.h +++ b/Gui/mplayer/mw.h @@ -665,26 +665,42 @@ void mplDandDHandler(int num,const char** files) /* now fill it with new items */ for(f=0; f < num; f++){ - char* str = files[f]; + char* str = strdup( files[f] ); plItem* item; + + if ( strchr( str,'%' ) ) + { + char * t = calloc( 1,strlen( str ) ); + int i,c = 0; + for ( i=0;i < strlen( str );i++ ) + if ( str[i] != '%' ) t[c++]=str[i]; + else + { + char tmp[4] = "0xXX"; +// if ( str[++i] == '%' ) { t[c++]='%'; continue; }; + tmp[2]=str[++i]; tmp[3]=str[++i]; t[c++]=(char)strtol( tmp,(char **)NULL,16 ); + } + free( str ); str=t; + } + if(stat(str,&buf) == 0 && S_ISDIR(buf.st_mode) == 0) { /* this is not a directory so try to play it */ printf("Received D&D %s\n",str); item = calloc(1,sizeof(plItem)); + /* FIXME: decompose file name ? */ /* yes -- Pontscho */ if ( strrchr( str,'/' ) ) { - char * t = strdup( str ); - char * s = strrchr( t,'/' ); *s=0; s++; + char * s = strrchr( str,'/' ); *s=0; s++; item->name = gstrdup( s ); - item->path = gstrdup( t ); - free( t ); + item->path = gstrdup( str ); } else { item->name = strdup(str); item->path = strdup(""); } gtkSet(gtkAddPlItem,0,(void*)item); } else { printf("Received not a file: %s !\n",str); } + free( str ); } mplSetFileName( NULL,files[0] ); |