[Thunar-dev] Proper way to determine the type of a file more accurate than thunar_file_get_content_type()

Hubert Hesse xfce at hubertscorner.de
Fri Apr 29 00:04:19 CEST 2011


Hi,

I am working on #2913 "Svg files cause thunar window to freeze".

The problem resulted from a gdk function gdk_pixbuf_get_file_info() in
thunar-list-model.c which works not well on certain svg with embedded
jpg (takes ages to load). Or cause Thunar to crash when clicking on
empty svg like:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<html><body><svg></svg></body></html>

I supplied a patch which fixes the bug as long as the outcome of
thunar_file_get_content_type (file) and respectively
g_file_info_get_content_type() is correct.

However this is not the case on my box. It seems that the result of the
two functions mentioned changes with the file extension.
So renaming the empty svg to svg.jpg makes the patch useless and thunar
crashes again.

Is there a way to determine the type of a file more accurate than
thunar_file_get_content_type()?
E.g. can I introduce libgmagic?

Or would it be a better solution to temporally disable the image size
detection completely until the bug in gdk-pixbuf:
https://bugzilla.gnome.org/show_bug.cgi?id=647803 is fixed?

kind regards,
Hubert Hese



More information about the Thunar-dev mailing list