appDisplay: use ShellAppCache to access GAppInfo
Calls to Gio.AppInfo.get_all() can perform quite a bit of I/O on the calling thread. This can potentially stall the compositor if the disk controller is saturated. Instead we can call the new ShellAppCache which contains cached information and performs all update I/O on a thread. Notifications of changes work very similar to GAppInfoMonitor via the ShellAppCache::changed() signal.
This commit is contained in:
parent
f87b9f374a
commit
cfb92ad392
@ -491,7 +491,7 @@ var AllView = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_loadApps() {
|
_loadApps() {
|
||||||
let apps = Gio.AppInfo.get_all().filter(appInfo => {
|
let apps = Shell.AppCache.get_default().get_all().filter(appInfo => {
|
||||||
try {
|
try {
|
||||||
let id = appInfo.get_id(); // catch invalid file encodings
|
let id = appInfo.get_id(); // catch invalid file encodings
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
@ -1321,7 +1321,7 @@ var FolderIcon = new Lang.Class({
|
|||||||
folderApps.forEach(addAppId);
|
folderApps.forEach(addAppId);
|
||||||
|
|
||||||
let folderCategories = this._folder.get_strv('categories');
|
let folderCategories = this._folder.get_strv('categories');
|
||||||
Gio.AppInfo.get_all().forEach(appInfo => {
|
Shell.AppCache.get_default().get_all().forEach(appInfo => {
|
||||||
let appCategories = _getCategories(appInfo);
|
let appCategories = _getCategories(appInfo);
|
||||||
if (!_listsIntersect(folderCategories, appCategories))
|
if (!_listsIntersect(folderCategories, appCategories))
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user