[gnome-software] Never show core packages like kernel and glibc in the main application UI



commit 947626c8cded604181358434d336a793c1f6f5f3
Author: Richard Hughes <richard hughsie com>
Date:   Tue Sep 9 10:23:21 2014 +0100

    Never show core packages like kernel and glibc in the main application UI
    
    CORE is a subset of PACKAGE and needs to be special-cased.

 src/gs-plugin-loader.c |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 930fb9e..a8566f1 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -629,8 +629,10 @@ gs_plugin_loader_app_is_valid (GsApp *app, gpointer user_data)
        }
 
        /* don't show unconverted packages in the application view */
-       if (gs_app_get_kind (app) == GS_APP_KIND_PACKAGE) {
-//             g_debug ("app invalid as only a package %s",
+       if (gs_app_get_kind (app) == GS_APP_KIND_PACKAGE ||
+           gs_app_get_kind (app) == GS_APP_KIND_CORE) {
+//             g_debug ("app invalid as only a %s: %s",
+//                      gs_app_kind_to_string (gs_app_get_kind (app)),
 //                      gs_plugin_loader_get_app_str (app));
                return FALSE;
        }
@@ -867,6 +869,21 @@ gs_plugin_loader_free_async_state (GsPluginLoaderAsyncState *state)
 /******************************************************************************/
 
 /**
+ * gs_plugin_loader_merge_into_os_update:
+ **/
+static gboolean
+gs_plugin_loader_merge_into_os_update (GsApp *app)
+{
+       if (gs_app_get_kind (app) == GS_APP_KIND_PACKAGE)
+               return TRUE;
+       if (gs_app_get_kind (app) == GS_APP_KIND_CORE)
+               return TRUE;
+       if (gs_app_get_kind (app) == GS_APP_KIND_SOURCE)
+               return TRUE;
+       return FALSE;
+}
+
+/**
  * gs_plugin_loader_add_os_update_item:
  **/
 static GList *
@@ -883,8 +900,10 @@ gs_plugin_loader_add_os_update_item (GList *list)
        /* do we have any packages left that are not apps? */
        for (l = list; l != NULL; l = l->next) {
                app_tmp = GS_APP (l->data);
-               if (gs_app_get_kind (app_tmp) == GS_APP_KIND_PACKAGE)
+               if (gs_plugin_loader_merge_into_os_update (app_tmp)) {
                        has_os_update = TRUE;
+                       break;
+               }
        }
        if (!has_os_update)
                goto out;
@@ -908,7 +927,7 @@ gs_plugin_loader_add_os_update_item (GList *list)
                                gs_app_get_summary (app_os));
        for (l = list; l != NULL; l = l->next) {
                app_tmp = GS_APP (l->data);
-               if (gs_app_get_kind (app_tmp) != GS_APP_KIND_PACKAGE)
+               if (!gs_plugin_loader_merge_into_os_update (app_tmp))
                        continue;
                gs_app_add_related (app_os, app_tmp);
        }


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