X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=libdocument%2Fev-file-helpers.c;h=3da4a59832d5031bedac8c19a00c3ef62fc4686b;hb=776a6fe02961d8901d21e172633d3c8d1c85dc93;hp=7b9a9e9cfbe30ed4d8a468d402f9fb02ae2bf92b;hpb=7d8aa7727a74f84c6fc473dbe87a923fd2c25959;p=evince.git diff --git a/libdocument/ev-file-helpers.c b/libdocument/ev-file-helpers.c index 7b9a9e9c..3da4a598 100644 --- a/libdocument/ev-file-helpers.c +++ b/libdocument/ev-file-helpers.c @@ -122,6 +122,12 @@ ev_tmp_filename (const gchar *prefix) return filename; } +gchar * +ev_tmp_directory (const gchar *prefix) +{ + return ev_tmp_filename (prefix ? prefix : "directory"); +} + /* Remove a local temp file created by evince */ void ev_tmp_filename_unlink (const gchar *filename) @@ -222,6 +228,7 @@ get_mime_type_from_uri (const gchar *uri, GError **error) GFile *file; GFileInfo *file_info; const gchar *content_type; + gchar *mime_type = NULL; file = g_file_new_for_uri (uri); file_info = g_file_query_info (file, @@ -233,12 +240,12 @@ get_mime_type_from_uri (const gchar *uri, GError **error) return NULL; content_type = g_file_info_get_content_type (file_info); - g_object_unref (file_info); + if (content_type) { + mime_type = g_content_type_get_mime_type (content_type); + } - if (!content_type) - return NULL; - - return g_content_type_get_mime_type (content_type); + g_object_unref (file_info); + return mime_type; } static gchar *