VFSMimeType* vfs_mime_type_get_from_type( const char* type ) { VFSMimeType * mime_type; g_static_rw_lock_reader_lock( &mime_hash_lock ); mime_type = g_hash_table_lookup( mime_hash, type ); g_static_rw_lock_reader_unlock( &mime_hash_lock ); if ( !mime_type ) { mime_type = vfs_mime_type_new( type ); g_static_rw_lock_writer_lock( &mime_hash_lock ); g_hash_table_insert( mime_hash, mime_type->type, mime_type ); g_static_rw_lock_writer_unlock( &mime_hash_lock ); } vfs_mime_type_ref( mime_type ); return mime_type; }
VFSMimeType* vfs_file_info_get_mime_type( VFSFileInfo* fi ) { vfs_mime_type_ref( fi->mime_type ); return fi->mime_type; }