From f5a28c2f24398bbd2284513460945c71396059b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 19 Sep 2017 23:58:29 +0200 Subject: [PATCH] remoteSearch: Fix remote search providers Commit 289f982949c2 broke all remote providers when adding support for non-auto-started search providers: Whether the provider should be auto-started needs to be known in the constructor, so setting the property on the constructed object doesn't work. https://bugzilla.gnome.org/show_bug.cgi?id=787986 --- js/ui/remoteSearch.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js index a7be9265d..de09ae979 100644 --- a/js/ui/remoteSearch.js +++ b/js/ui/remoteSearch.js @@ -98,6 +98,13 @@ function loadRemoteSearchProviders(searchSettings, callback) { return; } + let autoStart = true; + try { + autoStart = keyfile.get_boolean(group, 'AutoStart'); + } catch(e) { + // ignore error + } + let version = '1'; try { version = keyfile.get_string(group, 'Version'); @@ -106,9 +113,9 @@ function loadRemoteSearchProviders(searchSettings, callback) { } if (version >= 2) - remoteProvider = new RemoteSearchProvider2(appInfo, busName, objectPath); + remoteProvider = new RemoteSearchProvider2(appInfo, busName, objectPath, autoStart); else - remoteProvider = new RemoteSearchProvider(appInfo, busName, objectPath); + remoteProvider = new RemoteSearchProvider(appInfo, busName, objectPath, autoStart); remoteProvider.defaultEnabled = true; try { @@ -117,13 +124,6 @@ function loadRemoteSearchProviders(searchSettings, callback) { // ignore error } - remoteProvider.autoStart = true; - try { - remoteProvider.autoStart = keyfile.get_boolean(group, 'AutoStart'); - } catch(e) { - // ignore error - } - objectPaths[objectPath] = remoteProvider; loadedProviders.push(remoteProvider); } catch(e) { @@ -191,12 +191,12 @@ function loadRemoteSearchProviders(searchSettings, callback) { var RemoteSearchProvider = new Lang.Class({ Name: 'RemoteSearchProvider', - _init: function(appInfo, dbusName, dbusPath, proxyInfo) { + _init: function(appInfo, dbusName, dbusPath, autoStart, proxyInfo) { if (!proxyInfo) proxyInfo = SearchProviderProxyInfo; let g_flags = Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES; - if (remoteProvider.autoStart) + if (autoStart) g_flags |= Gio.DBusProxyFlags.DO_NOT_AUTO_START_AT_CONSTRUCTION; else g_flags |= Gio.DBusProxyFlags.DO_NOT_AUTO_START; @@ -319,8 +319,8 @@ var RemoteSearchProvider2 = new Lang.Class({ Name: 'RemoteSearchProvider2', Extends: RemoteSearchProvider, - _init: function(appInfo, dbusName, dbusPath) { - this.parent(appInfo, dbusName, dbusPath, SearchProvider2ProxyInfo); + _init: function(appInfo, dbusName, dbusPath, autoStart) { + this.parent(appInfo, dbusName, dbusPath, autoStart, SearchProvider2ProxyInfo); this.canLaunchSearch = true; },