dash: reload favorites when the installed app change

Force a reload of the favorite system, to pick apps that were
uninstalled.

https://bugzilla.gnome.org/show_bug.cgi?id=706878
This commit is contained in:
Giovanni Campagna 2013-08-27 14:00:26 +02:00 committed by Giovanni Campagna
parent 6fbe765636
commit e26a6ea71b
2 changed files with 7 additions and 4 deletions

View File

@ -14,15 +14,15 @@ const AppFavorites = new Lang.Class({
_init: function() { _init: function() {
this._favorites = {}; this._favorites = {};
global.settings.connect('changed::' + this.FAVORITE_APPS_KEY, Lang.bind(this, this._onFavsChanged)); global.settings.connect('changed::' + this.FAVORITE_APPS_KEY, Lang.bind(this, this._onFavsChanged));
this._reload(); this.reload();
}, },
_onFavsChanged: function() { _onFavsChanged: function() {
this._reload(); this.reload();
this.emit('changed'); this.emit('changed');
}, },
_reload: function() { reload: function() {
let ids = global.settings.get_strv(this.FAVORITE_APPS_KEY); let ids = global.settings.get_strv(this.FAVORITE_APPS_KEY);
let appSys = Shell.AppSystem.get_default(); let appSys = Shell.AppSystem.get_default();
let apps = ids.map(function (id) { let apps = ids.map(function (id) {

View File

@ -423,7 +423,10 @@ const Dash = new Lang.Class({
this._appSystem = Shell.AppSystem.get_default(); this._appSystem = Shell.AppSystem.get_default();
this._appSystem.connect('installed-changed', Lang.bind(this, this._queueRedisplay)); this._appSystem.connect('installed-changed', Lang.bind(this, function() {
AppFavorites.getAppFavorites().reload();
his._queueRedisplay();
}));
AppFavorites.getAppFavorites().connect('changed', Lang.bind(this, this._queueRedisplay)); AppFavorites.getAppFavorites().connect('changed', Lang.bind(this, this._queueRedisplay));
this._appSystem.connect('app-state-changed', Lang.bind(this, this._queueRedisplay)); this._appSystem.connect('app-state-changed', Lang.bind(this, this._queueRedisplay));