[gnome-shell/wip/exalm/wallpaper] background: Check xml mime type instead of extension




commit 034842db7215664cc13d25b89212e4dfebb25181
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Fri Apr 16 19:17:33 2021 +0500

    background: Check xml mime type instead of extension
    
    This is required to be able to set animated wallpapers with the wallpaper
    portal, which names them 'background' without an extension.
    
    See https://gitlab.gnome.org/bertob/nostalgia/-/merge_requests/12

 js/ui/background.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/background.js b/js/ui/background.js
index df2d98112f..931053834f 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -480,7 +480,14 @@ var Background = GObject.registerClass({
     }
 
     _loadFile(file) {
-        if (file.get_basename().endsWith('.xml'))
+        const info = file.query_info(
+            Gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+            Gio.FileQueryInfoFlags.NONE,
+            null
+        );
+
+        const contentType = info.get_content_type();
+        if (contentType === 'application/xml')
             this._loadAnimation(file);
         else
             this._loadImage(file);


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