[gnome-shell/wip/exalm/wallpaper] background: Check xml mime type instead of extension
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/exalm/wallpaper] background: Check xml mime type instead of extension
- Date: Fri, 16 Apr 2021 15:05:56 +0000 (UTC)
commit 58ed969dd1f71e05d68455cd00369956160b5216
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
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1816>
js/ui/background.js | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/background.js b/js/ui/background.js
index df2d98112f..1f7c5e5720 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -101,6 +101,8 @@ const LoginManager = imports.misc.loginManager;
const Main = imports.ui.main;
const Params = imports.misc.params;
+Gio._promisify(Gio._LocalFilePrototype, 'query_info_async', 'query_info_finish');
+
var DEFAULT_BACKGROUND_COLOR = Clutter.Color.from_pixel(0x2e3436ff);
const BACKGROUND_SCHEMA = 'org.gnome.desktop.background';
@@ -479,8 +481,15 @@ var Background = GObject.registerClass({
}
}
- _loadFile(file) {
- if (file.get_basename().endsWith('.xml'))
+ async _loadFile(file) {
+ const info = await file.query_info_async(
+ Gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ Gio.FileQueryInfoFlags.NONE,
+ 0,
+ 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]