[gnome-software] trivial: The application is installed if we found a desktop file for it



commit b59332daf826903938b482bb42b3468e9901696c
Author: Richard Hughes <richard hughsie com>
Date:   Mon Oct 21 14:19:57 2013 +0100

    trivial: The application is installed if we found a desktop file for it

 src/plugins/gs-plugin-datadir-filename-local.c |   10 ++++------
 src/plugins/gs-plugin-datadir-filename.c       |    2 ++
 2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/gs-plugin-datadir-filename-local.c b/src/plugins/gs-plugin-datadir-filename-local.c
index 80115aa..84b156b 100644
--- a/src/plugins/gs-plugin-datadir-filename-local.c
+++ b/src/plugins/gs-plugin-datadir-filename-local.c
@@ -62,14 +62,12 @@ gs_plugin_refine (GsPlugin *plugin,
                tmp = gs_app_get_metadata_item (app, "DataDir::desktop-filename");
                if (tmp == NULL)
                        continue;
-               if (!g_str_has_prefix (tmp, "/usr")) {
-                       /* FIXME: If the user tries to remove this, we don't
-                        * have a way of removing jhbuilt packages other than
-                        * from deleting the .desktop file */
-                       g_debug ("Desktop file not in /usr, assuming installed");
+               if (!g_file_test (tmp, G_FILE_TEST_EXISTS))
+                       continue;
+               if (gs_app_get_state (app) == GS_APP_STATE_UNKNOWN)
                        gs_app_set_state (app, GS_APP_STATE_INSTALLED);
+               if (gs_app_get_kind (app) == GS_APP_KIND_UNKNOWN)
                        gs_app_set_kind (app, GS_APP_KIND_NORMAL);
-               }
        }
        return TRUE;
 }
diff --git a/src/plugins/gs-plugin-datadir-filename.c b/src/plugins/gs-plugin-datadir-filename.c
index 895103e..7f53932 100644
--- a/src/plugins/gs-plugin-datadir-filename.c
+++ b/src/plugins/gs-plugin-datadir-filename.c
@@ -155,6 +155,8 @@ gs_plugin_refine (GsPlugin *plugin,
 
                tmp = gs_plugin_datadir_filename_find (plugin, app);
                if (tmp != NULL) {
+                       if (gs_app_get_state (app) == GS_APP_STATE_UNKNOWN)
+                               gs_app_set_state (app, GS_APP_STATE_INSTALLED);
                        gs_app_set_metadata (app,
                                             "DataDir::desktop-filename",
                                             tmp);


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