[gnome-shell] fileUtils: Delete deleteGFile hack
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] fileUtils: Delete deleteGFile hack
- Date: Tue, 26 Nov 2019 22:22:47 +0000 (UTC)
commit 0a9e1b417377eda0a7b415f13f4d75f17fd597f8
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Nov 25 22:54:44 2019 +0100
fileUtils: Delete deleteGFile hack
It is true that delete is a javascript keyword, but that doesn't
prevent it from being used as method name - there are event built-in
types like Map or Set with delete() methods!
So if that hack was ever needed, this hasn't been the case for years
now; just removed the hack now.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/862
js/misc/fileUtils.js | 11 +++--------
js/ui/extensionSystem.js | 2 +-
2 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/js/misc/fileUtils.js b/js/misc/fileUtils.js
index bf92389903..1abe64c2ea 100644
--- a/js/misc/fileUtils.js
+++ b/js/misc/fileUtils.js
@@ -1,5 +1,5 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-/* exported collectFromDatadirs, deleteGFile, recursivelyDeleteDir,
+/* exported collectFromDatadirs, recursivelyDeleteDir,
recursivelyMoveDir, loadInterfaceXML */
const { Gio, GLib } = imports.gi;
@@ -29,11 +29,6 @@ function collectFromDatadirs(subdir, includeUserDir, processFile) {
}
}
-function deleteGFile(file) {
- // Work around 'delete' being a keyword in JS.
- return file['delete'](null);
-}
-
function recursivelyDeleteDir(dir, deleteParent) {
let children = dir.enumerate_children('standard::name,standard::type',
Gio.FileQueryInfoFlags.NONE, null);
@@ -43,13 +38,13 @@ function recursivelyDeleteDir(dir, deleteParent) {
let type = info.get_file_type();
let child = dir.get_child(info.get_name());
if (type == Gio.FileType.REGULAR)
- deleteGFile(child);
+ child.delete(null);
else if (type == Gio.FileType.DIRECTORY)
recursivelyDeleteDir(child, true);
}
if (deleteParent)
- deleteGFile(dir);
+ dir.delete(null);
}
function recursivelyMoveDir(srcDir, destDir) {
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index f9fc71b76a..f7aca5ce9c 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -41,7 +41,7 @@ var ExtensionManager = class {
}
GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 60, () => {
- FileUtils.deleteGFile(disableFile);
+ disableFile.delete(null);
return GLib.SOURCE_REMOVE;
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]