[gnome-shell] runDialog: use fileUtils.listDirAsync in CommandCompleter
- From: Maxim Ermilov <mermilov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] runDialog: use fileUtils.listDirAsync in CommandCompleter
- Date: Mon, 17 Jan 2011 21:45:04 +0000 (UTC)
commit 883f51be939abc63fa563aecf691135702e35d4d
Author: Maxim Ermilov <zaspire rambler ru>
Date: Tue Jan 18 00:30:12 2011 +0300
runDialog: use fileUtils.listDirAsync in CommandCompleter
https://bugzilla.gnome.org/show_bug.cgi?id=623708
js/ui/runDialog.js | 27 +++++++--------------------
1 files changed, 7 insertions(+), 20 deletions(-)
---
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index 88c0579..6d07ee2 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -11,6 +11,7 @@ const Signals = imports.signals;
const Gettext = imports.gettext.domain('gnome-shell');
const _ = Gettext.gettext;
+const FileUtils = imports.misc.fileUtils;
const Main = imports.ui.main;
const ModalDialog = imports.ui.modalDialog;
const Tweener = imports.ui.tweener;
@@ -63,25 +64,6 @@ CommandCompleter.prototype = {
this._update(0);
},
- _onGetEnumerateComplete : function(obj, res) {
- this._enumerator = obj.enumerate_children_finish(res);
- this._enumerator.next_files_async(100, GLib.PRIORITY_LOW, null, Lang.bind(this, this._onNextFileComplete));
- },
-
- _onNextFileComplete : function(obj, res) {
- let files = obj.next_files_finish(res);
- for (let i = 0; i < files.length; i++) {
- this._childs[this._i].push(files[i].get_name());
- }
- if (files.length) {
- this._enumerator.next_files_async(100, GLib.PRIORITY_LOW, null, Lang.bind(this, this._onNextFileComplete));
- } else {
- this._enumerator.close(null);
- this._enumerator = null;
- this._update(this._i + 1);
- }
- },
-
update : function() {
if (this._valid)
return;
@@ -101,7 +83,12 @@ CommandCompleter.prototype = {
}
let file = Gio.file_new_for_path(this._paths[i]);
this._childs[this._i] = [];
- file.enumerate_children_async(Gio.FILE_ATTRIBUTE_STANDARD_NAME, Gio.FileQueryInfoFlags.NONE, GLib.PRIORITY_LOW, null, Lang.bind(this, this._onGetEnumerateComplete));
+ FileUtils.listDirAsync(file, Lang.bind(this, function (files) {
+ for (let i = 0; i < files.length; i++) {
+ this._childs[this._i].push(files[i].get_name());
+ }
+ this._update(this._i + 1);
+ }));
},
_onChanged : function(m, f, of, type) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]