Skip to content

content type to mime type conversion

mugiseyebrows requested to merge mugiseyebrows/eog:master into master

This PR fixes #214

mime type and content type are the same things only on unix, on windows and macos they are different things, so they cannot be used interchangably. As a result eog doesn't see any images in directory on windows, and dont show next image on array keys pressed.

For example content type for image.jpg on windows is .jpg, so load_uri in code below will always be FALSE on non-unix OS.

static void
directory_visit (GFile *directory,
		 GFileInfo *children_info,
		 EogListStore *store)
	gboolean load_uri = FALSE;
	mime_type = g_file_info_get_content_type (children_info);
	name = g_file_info_get_name (children_info);

        if (!g_str_has_prefix (name, ".")) {
		if (eog_image_is_supported_mime_type (mime_type)) {
			load_uri = TRUE;

eog_image_is_supported_mime_type (".jpg") == FALSE

eog_image_is_supported_mime_type ("image/jpeg") == TRUE


There is g_content_type_get_mime_type utility function, on unix it's just g_strdup, on windows it uses registry to query for mime type.

Edited by mugiseyebrows

Merge request reports