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
This commit is contained in:
Cosimo Cecchi 2012-11-06 17:32:39 -05:00
parent 8e7758e280
commit cbc8ec6508

View File

@ -38,9 +38,22 @@ function loadRemoteSearchProviders(addProviderCallback) {
for (let i = 0; i < dataDirs.length; i++) { for (let i = 0; i < dataDirs.length; i++) {
let path = GLib.build_filenamev([dataDirs[i], 'gnome-shell', 'search-providers']); let path = GLib.build_filenamev([dataDirs[i], 'gnome-shell', 'search-providers']);
let dir = Gio.file_new_for_path(path); let dir = Gio.file_new_for_path(path);
if (!dir.query_exists(null))
continue; 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); loadRemoteSearchProvidersFromDir(dir, loadedProviders, addProviderCallback);
});
} }
}; };