[gnome-shell/gnome-3-22] appFavorites: Only use renamed ID if it can be resolved



commit 0fb146ed378dccd23c7390fd5879e0a18be6e6bc
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Mar 4 19:01:32 2015 +0100

    appFavorites: Only use renamed ID if it can be resolved
    
    We currently assume that if a .desktop file has been renamed (that
    is, it is in our rename list), the updated ID will be used. That
    assumption was mostly sound when the list contained only GNOME apps
    following the same release cycle as gnome-shell, but as applications
    with less ties to the GNOME schedule adopt the reverse DNS notation,
    it becomes more likely for apps to appear in the list before actually
    being updated on the system. Handle this case by only renaming IDs
    for which the replacement can be resolved to an existing application.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745626

 js/ui/appFavorites.js |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/appFavorites.js b/js/ui/appFavorites.js
index 2f3e780..8f65c7f 100644
--- a/js/ui/appFavorites.js
+++ b/js/ui/appFavorites.js
@@ -57,12 +57,14 @@ const AppFavorites = new Lang.Class({
 
     reload: function() {
         let ids = global.settings.get_strv(this.FAVORITE_APPS_KEY);
+        let appSys = Shell.AppSystem.get_default();
 
         // Map old desktop file names to the current ones
         let updated = false;
         ids = ids.map(function (id) {
             let newId = RENAMED_DESKTOP_IDS[id];
-            if (newId !== undefined) {
+            if (newId !== undefined &&
+                appSys.lookup_app(newId) != null) {
                 updated = true;
                 return newId;
             }
@@ -72,7 +74,6 @@ const AppFavorites = new Lang.Class({
         if (updated)
             global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
 
-        let appSys = Shell.AppSystem.get_default();
         let apps = ids.map(function (id) {
                 return appSys.lookup_app(id);
             }).filter(function (app) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]