[gnome-shell] remote-search: don't use g_file_query_exists()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] remote-search: don't use g_file_query_exists()
- Date: Tue, 6 Nov 2012 23:17:49 +0000 (UTC)
commit cbc8ec65082557c8a83496440866a88c85c69fe3
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Nov 6 17:32:39 2012 -0500
remote-search: don't use g_file_query_exists()
This is called in the main thread, which we should never block for
synchronous I/O.
Since the operation we're wrapping is async already, just use
g_file_query_info_async() instead.
https://bugzilla.gnome.org/show_bug.cgi?id=687491
js/ui/remoteSearch.js | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js
index 0625475..c4462e9 100644
--- a/js/ui/remoteSearch.js
+++ b/js/ui/remoteSearch.js
@@ -38,9 +38,22 @@ function loadRemoteSearchProviders(addProviderCallback) {
for (let i = 0; i < dataDirs.length; i++) {
let path = GLib.build_filenamev([dataDirs[i], 'gnome-shell', 'search-providers']);
let dir = Gio.file_new_for_path(path);
- if (!dir.query_exists(null))
- continue;
- loadRemoteSearchProvidersFromDir(dir, loadedProviders, addProviderCallback);
+
+ dir.query_info_async('standard:type', Gio.FileQueryInfoFlags.NONE,
+ GLib.PRIORITY_DEFAULT, null,
+ function(object, res) {
+ let exists = false;
+ try {
+ object.query_info_finish(res);
+ exists = true;
+ } catch (e) {
+ }
+
+ if (!exists)
+ return;
+
+ loadRemoteSearchProvidersFromDir(dir, loadedProviders, addProviderCallback);
+ });
}
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]