[gnome-shell] search: Don't throw if provider directories don't exist
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] search: Don't throw if provider directories don't exist
- Date: Sat, 27 Jul 2013 15:00:18 +0000 (UTC)
commit a3236997bee6eb8b487c9e1d72379751da6ba0ae
Author: Colin Walters <walters verbum org>
Date: Sat Jul 27 10:55:57 2013 -0400
search: Don't throw if provider directories don't exist
There's no /usr/local/share/gnome-shell/search-providers, so don't
throw if we don't find it.
js/ui/remoteSearch.js | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js
index f998a2f..b1f485e 100644
--- a/js/ui/remoteSearch.js
+++ b/js/ui/remoteSearch.js
@@ -116,11 +116,18 @@ function loadRemoteSearchProviders(addProviderCallback) {
dataDirs.forEach(function(dataDir) {
let path = GLib.build_filenamev([dataDir, 'gnome-shell', 'search-providers']);
let dir = Gio.File.new_for_path(path);
- let fileEnum = dir.enumerate_children('standard::name,standard::type',
+ let fileEnum;
+ try {
+ fileEnum = dir.enumerate_children('standard::name,standard::type',
Gio.FileQueryInfoFlags.NONE, null);
- let info;
- while ((info = fileEnum.next_file(null)))
- loadRemoteSearchProvider(fileEnum.get_child(info));
+ } catch (e) {
+ fileEnum = null;
+ }
+ if (fileEnum != null) {
+ let info;
+ while ((info = fileEnum.next_file(null)))
+ loadRemoteSearchProvider(fileEnum.get_child(info));
+ }
});
let searchSettings = new Gio.Settings({ schema: Search.SEARCH_PROVIDERS_SCHEMA });
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]