[gnome-software] packagekit-refine: don't override the state if already known



commit 9a02144e8018d843b82ebdae2cf41f9b0152d15b
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Sep 8 16:04:36 2013 +0200

    packagekit-refine: don't override the state if already known
    
    The flow is like this: the GsShell calls get_popular(),
    hardcoded-popular replies with a list of GsApps without metadata.
    For each app, datadir-filename finds the .desktop file, in this
    case in a jhbuild directory; datadir-filename-local notes that
    the app is not from /usr, and marks it installed. appstream
    also knows about the app, and sets a package-name.
    Finally, packagekit-refine sees the app does not have a package-id
    (because it didn't originate from packagekit), so it searches
    for one. At that point, it would set the installed status
    according to the package, but that's wrong, because the app
    is installed locally.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707728
    
    Signed-off-by: Richard Hughes <richard hughsie com>

 src/plugins/gs-plugin-packagekit-refine.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 96e5efc..f315688 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -192,10 +192,12 @@ gs_plugin_packagekit_refine_packages (GsPlugin *plugin,
                        package = g_ptr_array_index (packages, i);
                        if (g_strcmp0 (pk_package_get_name (package), pkgname) == 0) {
                                gs_app_set_metadata (app, "package-id", pk_package_get_id (package));
-                               gs_app_set_state (app,
-                                                 pk_package_get_info (package) == PK_INFO_ENUM_INSTALLED ?
-                                                 GS_APP_STATE_INSTALLED :
-                                                 GS_APP_STATE_AVAILABLE);
+                               if (gs_app_get_state (app) == GS_APP_STATE_UNKNOWN) {
+                                       gs_app_set_state (app,
+                                                         pk_package_get_info (package) == 
PK_INFO_ENUM_INSTALLED ?
+                                                         GS_APP_STATE_INSTALLED :
+                                                         GS_APP_STATE_AVAILABLE);
+                               }
                                cnt++;
                        }
                }


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