extensionSystem: Add "UninstallExtension" DBus method

For those who like their system pure, this provides the ability to purge a
pesky extension and its precious place on your disk space, and in your
"Local Extension" list.

https://bugzilla.gnome.org/show_bug.cgi?id=658612

Conflicts:

	js/ui/extensionSystem.js
This commit is contained in:
Jasper St. Pierre
2011-09-10 17:10:50 -04:00
parent d5e6ea6ebd
commit 7928f90cf6
3 changed files with 62 additions and 0 deletions

View File

@ -20,3 +20,25 @@ function listDirAsync(file, callback) {
enumerator.next_files_async(100, GLib.PRIORITY_LOW, null, onNextFileComplete);
});
}
function deleteGFile(file) {
// Work around 'delete' being a keyword in JS.
return file['delete'](null);
}
function recursivelyDeleteDir(dir) {
let children = dir.enumerate_children('standard::name,standard::type',
Gio.FileQueryInfoFlags.NONE, null);
let info, child;
while ((info = children.next_file(null)) != null) {
let type = info.get_file_type();
let child = dir.get_child(info.get_name());
if (type == Gio.FileType.REGULAR)
deleteGFile(child);
else if (type == Gio.TypeType.DIRECTORY)
recursivelyDeleteDir(child);
}
deleteGFile(dir);
}