[gthumb: 2/5] jxl: Add JXL_IS_UNKNOWN_TO_GLIB directive so that all *.jxl files are recognised as having the image




commit f264121be80c9f981e01f178f95c380193cf9969
Author: Ian Tester <imroykun gmail com>
Date:   Sun Feb 28 03:07:32 2021 +1100

    jxl: Add JXL_IS_UNKNOWN_TO_GLIB directive so that all *.jxl files are recognised as having the image/jxl 
mime type
    
    Just like the WEBP_IS_UNKNOWN_TO_GLIB directive.
    Also a small typo fix in meson.build

 gthumb/glib-utils.c            | 5 +++++
 gthumb/gth-metadata-provider.c | 8 +++++++-
 meson.build                    | 3 ++-
 3 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gthumb/glib-utils.c b/gthumb/glib-utils.c
index d7cb4c49..672faab6 100644
--- a/gthumb/glib-utils.c
+++ b/gthumb/glib-utils.c
@@ -1737,6 +1737,11 @@ _g_content_type_guess_from_name (const char *filename)
                return "image/webp";
 #endif
 
+#if JXL_IS_UNKNOWN_TO_GLIB
+       if (_g_str_equal (_g_path_get_extension (filename), ".jxl"))
+               return "image/jxl";
+#endif
+
        return g_content_type_guess (filename, NULL, 0, NULL);
 }
 
diff --git a/gthumb/gth-metadata-provider.c b/gthumb/gth-metadata-provider.c
index ddc3ee9d..166123ad 100644
--- a/gthumb/gth-metadata-provider.c
+++ b/gthumb/gth-metadata-provider.c
@@ -178,7 +178,7 @@ _g_query_metadata_async_thread (GTask        *task,
                        break;
                }
 
-#if WEBP_IS_UNKNOWN_TO_GLIB
+#if WEBP_IS_UNKNOWN_TO_GLIB || JXL_IS_UNKNOWN_TO_GLIB
                if (_g_file_attributes_matches_any_v (G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
                                                      G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
                                                      qmd->attributes_v))
@@ -188,8 +188,14 @@ _g_query_metadata_async_thread (GTask        *task,
 
                        uri = g_file_get_uri (file_data->file);
                        ext = _g_uri_get_extension (uri);
+#if WEBP_IS_UNKNOWN_TO_GLIB
                        if (g_strcmp0 (ext, ".webp") == 0)
                                gth_file_data_set_mime_type (file_data, "image/webp");
+#endif
+#if JXL_IS_UNKNOWN_TO_GLIB
+                       if (g_strcmp0 (ext, ".jxl") == 0)
+                               gth_file_data_set_mime_type (file_data, "image/jxl");
+#endif
 
                        g_free (ext);
                        g_free (uri);
diff --git a/meson.build b/meson.build
index 21295ed6..d6b3f505 100644
--- a/meson.build
+++ b/meson.build
@@ -289,10 +289,11 @@ if use_libtiff
 endif
 if use_libwebp
   config_data.set('HAVE_LIBWEBP', 1)
-  config_data.set('WEBP_IS_UNKNOWN_TO_GLIB', 1) # Define to 1 if webp images area not recognized by the glib 
functions
+  config_data.set('WEBP_IS_UNKNOWN_TO_GLIB', 1) # Define to 1 if webp images are not recognized by the glib 
functions
 endif
 if use_libjxl
   config_data.set('HAVE_LIBJXL', 1)
+  config_data.set('JXL_IS_UNKNOWN_TO_GLIB', 1) # Define to 1 if jxl images are not recognized by the glib 
functions
 endif
 if use_libraw
   config_data.set('HAVE_LIBRAW', 1)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]