appFavorites: Don't add app explicitly

When adding a favorite, we add the ID to the list of favorites, save the
setting and add the new app to the favorites map. However as writing the
settings value already results in reload() to update the favorites map,
the new app is usually already in the map when we add it.

The only exception is when the ID was found in the RENAMED_DESKTOP_IDS map,
in which case we end up adding both the renamed app and the original one.
Fix this by simply relying on reload() to properly update the map, just like
we already do in _removeFavorite().

https://gitlab.gnome.org/GNOME/gnome-shell/issues/471
This commit is contained in:
Florian Müllner 2018-08-12 02:17:42 +02:00 committed by Florian Müllner
parent 586a9ff9cd
commit 501a1aff68

View File

@ -128,7 +128,6 @@ var AppFavorites = new Lang.Class({
else
ids.splice(pos, 0, appId);
global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
this._favorites[appId] = app;
return true;
},