[gnome-software/gnome-3-16] Add a new ALLOW_PACKAGES refine flag



commit 1fc88305a90ca35c776f3d6da93eab9da16a004b
Author: Kalev Lember <kalevlember gmail com>
Date:   Sun May 10 19:56:40 2015 +0200

    Add a new ALLOW_PACKAGES refine flag
    
    This makes it possible for some of the UI to show packages if it sets
    the refine flag.

 src/gs-plugin-loader.c |   23 +++++++++++++----------
 src/gs-plugin.h        |    1 +
 2 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 6404491..a74e8c7 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -632,6 +632,8 @@ gs_plugin_loader_get_app_str (GsApp *app)
 static gboolean
 gs_plugin_loader_app_is_valid (GsApp *app, gpointer user_data)
 {
+       GsPluginLoaderAsyncState *state = (GsPluginLoaderAsyncState *) user_data;
+
        /* don't show unknown state */
        if (gs_app_get_state (app) == AS_APP_STATE_UNKNOWN) {
                g_debug ("app invalid as state unknown %s",
@@ -662,8 +664,9 @@ 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 ||
-           gs_app_get_kind (app) == GS_APP_KIND_CORE) {
+       if (((state->flags & GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES) == 0) &&
+           (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));
@@ -997,7 +1000,7 @@ gs_plugin_loader_get_updates_thread_cb (GTask *task,
 
        /* remove any packages that are not proper applications or
         * OS updates */
-       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, NULL);
+       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
        if (state->list == NULL) {
                g_task_return_new_error (task,
                                         GS_PLUGIN_LOADER_ERROR,
@@ -1198,7 +1201,7 @@ gs_plugin_loader_get_installed_thread_cb (GTask *task,
        state->list = g_list_concat (state->list, g_list_copy_deep (plugin_loader->priv->queued_installs, 
(GCopyFunc)g_object_ref, NULL));
 
        /* filter package list */
-       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, NULL);
+       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
        if (state->list == NULL) {
                g_task_return_new_error (task,
                                         GS_PLUGIN_LOADER_ERROR,
@@ -1302,7 +1305,7 @@ gs_plugin_loader_get_popular_thread_cb (GTask *task,
        }
 
        /* filter package list */
-       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, NULL);
+       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
        gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_non_installed, NULL);
        gs_plugin_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
        gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
@@ -1412,7 +1415,7 @@ gs_plugin_loader_get_featured_thread_cb (GTask *task,
        if (g_getenv ("GNOME_SOFTWARE_FEATURED") != NULL) {
                gs_plugin_list_filter (&state->list, gs_plugin_loader_featured_debug, NULL);
        } else {
-               gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, NULL);
+               gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
                gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
                gs_plugin_list_randomize (&state->list);
        }
@@ -1630,7 +1633,7 @@ gs_plugin_loader_search_thread_cb (GTask *task,
 
        /* filter package list */
        gs_plugin_list_filter_duplicates (&state->list);
-       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, NULL);
+       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
        gs_plugin_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
        gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
        if (g_settings_get_boolean (plugin_loader->priv->settings, "require-appdata")) {
@@ -1796,7 +1799,7 @@ gs_plugin_loader_search_files_thread_cb (GTask *task,
 
        /* filter package list */
        gs_plugin_list_filter_duplicates (&state->list);
-       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, NULL);
+       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
        gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_non_installed, NULL);
        gs_plugin_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
        gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
@@ -1963,7 +1966,7 @@ gs_plugin_loader_search_what_provides_thread_cb (GTask *task,
 
        /* filter package list */
        gs_plugin_list_filter_duplicates (&state->list);
-       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, NULL);
+       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
        gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_non_installed, NULL);
        gs_plugin_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
        gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
@@ -2251,7 +2254,7 @@ gs_plugin_loader_get_category_apps_thread_cb (GTask *task,
        /* filter package list */
        gs_plugin_list_filter_duplicates (&state->list);
        gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_non_system, NULL);
-       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, NULL);
+       gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
        gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
        if (state->list == NULL) {
                g_task_return_new_error (task,
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index 94c5268..248c3a9 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -97,6 +97,7 @@ typedef enum {
        GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED          = 1 << 11,
        GS_PLUGIN_REFINE_FLAGS_REQUIRE_MENU_PATH        = 1 << 12,
        GS_PLUGIN_REFINE_FLAGS_REQUIRE_ADDONS           = 1 << 13,
+       GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES           = 1 << 14,
        GS_PLUGIN_REFINE_FLAGS_LAST
 } GsPluginRefineFlags;
 


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