void _GIO_localDispatch(GIOControl *gc) { char *path = u2def_copy(gc->path); char *topath; switch ( gc->gf ) { case gf_dir: _gio_file_dir(gc,path); break; case gf_statfile: _gio_file_statfile(gc,path); break; case gf_mkdir: _gio_file_mkdir(gc,path); break; case gf_delfile: _gio_file_delfile(gc,path); break; case gf_deldir: _gio_file_deldir(gc,path); break; case gf_renamefile: topath = cu_copy(gc->topath); _gio_file_renamefile(gc,path,topath); free(topath); break; default: break; } free(path); }
static int WithinList(struct gfc_data *d,GEvent *event) { GRect size; GGadget *list; int32 pos; unichar_t *ufile; char *file, **fontnames; int cnt, len; unichar_t *msg; if ( event->type!=et_mousemove ) return( false ); GFileChooserGetChildren(d->gfc,NULL, &list, NULL); if ( list==NULL ) return( false ); if ( !GGadgetWithin(list,event->u.mouse.x,event->u.mouse.y) ) return( false ); pos = GListIndexFromY(list,event->u.mouse.y); if ( pos == d->filename_popup_pos ) return( pos!=-1 ); if ( pos==-1 || GFileChooserPosIsDir(d->gfc,pos)) { d->filename_popup_pos = -1; return( pos!=-1 ); } ufile = GFileChooserFileNameOfPos(d->gfc,pos); if ( ufile==NULL ) return( true ); file = u2def_copy(ufile); free(ufile); fontnames = GetFontNames(file, 0); if ( fontnames==NULL || fontnames[0]==NULL ) msg = uc_copy( "???" ); else { len = 0; for ( cnt=0; fontnames[cnt]!=NULL; ++cnt ) len += strlen(fontnames[cnt])+1; msg = malloc((len+2)*sizeof(unichar_t)); len = 0; for ( cnt=0; fontnames[cnt]!=NULL; ++cnt ) { uc_strcpy(msg+len,fontnames[cnt]); len += strlen(fontnames[cnt]); msg[len++] = '\n'; } msg[len-1] = '\0'; } GGadgetPreparePopup(GGadgetGetWindow(d->gfc),msg); if ( fontnames!=NULL ) { for ( cnt=0; fontnames[cnt]!=NULL; ++cnt ) { free(fontnames[cnt]); } free(fontnames); } free(file); free(d->lastpopupfontname); d->lastpopupfontname = msg; return( true ); }