From f1275445e638d3c38c93457227602b7314f59d86 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Thu, 24 Jul 2025 09:26:33 -0400 Subject: Eom*: Use fast content type as fallback It turns out that, depending on the responsible GVfs implementation, a GFileInfo may not actually set the content type attribute even if requested. Since knowing the content type is rather critical for eom try to use the fast content type as a fallback in those cases. The fast content type should be hardly unknown as it is usually just based on the file extension. Fixes #360. Backported from https://gitlab.gnome.org/GNOME/eog/-/commit/de19faf73c8d8627193320d512c8b97316d9740c --- src/eom-window.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/eom-window.c') diff --git a/src/eom-window.c b/src/eom-window.c index c039d67..3d572f9 100644 --- a/src/eom-window.c +++ b/src/eom-window.c @@ -738,7 +738,8 @@ add_file_to_recent_files (GFile *file) return FALSE; file_info = g_file_query_info (file, - G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, + G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE"," + G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, 0, NULL, NULL); if (file_info == NULL) return FALSE; @@ -746,7 +747,7 @@ add_file_to_recent_files (GFile *file) recent_data = g_slice_new (GtkRecentData); recent_data->display_name = NULL; recent_data->description = NULL; - recent_data->mime_type = (gchar *) g_file_info_get_content_type (file_info); + recent_data->mime_type = (gchar *) eom_util_get_content_type_with_fallback (file_info); recent_data->app_name = EOM_RECENT_FILES_APP_NAME; recent_data->app_exec = g_strjoin(" ", g_get_prgname (), "%u", NULL); recent_data->groups = groups; @@ -955,13 +956,14 @@ eom_window_update_openwith_menu (EomWindow *window, EomImage *image) file = eom_image_get_file (image); file_info = g_file_query_info (file, - G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, + G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE"," + G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, 0, NULL, NULL); if (file_info == NULL) return; else { - mime_type = g_file_info_get_content_type (file_info); + mime_type = eom_util_get_content_type_with_fallback (file_info); } if (priv->open_with_menu_id != 0) { -- cgit v1.2.1