From cbc8ec65082557c8a83496440866a88c85c69fe3 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 6 Nov 2012 17:32:39 -0500 Subject: [PATCH] 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 file changed, 16 insertions(+), 3 deletions(-) diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js index 0625475c8..c4462e9f2 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); + }); } };