diff options
author | Victor Kareh <[email protected]> | 2025-07-24 09:26:33 -0400 |
---|---|---|
committer | Victor Kareh <[email protected]> | 2025-07-24 09:27:45 -0400 |
commit | f1275445e638d3c38c93457227602b7314f59d86 (patch) | |
tree | 431aca91c64e795b17ee9e1cac76a6ed2887569b /src/eom-window.c | |
parent | 1dcda49f5ca719dfea822a34ac7925246875240f (diff) | |
download | eom-fast-content-type.tar.bz2 eom-fast-content-type.tar.xz |
Eom*: Use fast content type as fallbackfast-content-type
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
Diffstat (limited to 'src/eom-window.c')
-rw-r--r-- | src/eom-window.c | 10 |
1 files changed, 6 insertions, 4 deletions
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) { |