[gnome-software] Add a new ALLOW_PACKAGES refine flag
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add a new ALLOW_PACKAGES refine flag
- Date: Mon, 11 May 2015 08:55:49 +0000 (UTC)
commit 78f22a3aec793355354985312b541ff5d35351e1
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 eeab414..c3ef950 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -504,6 +504,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",
@@ -534,8 +536,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));
@@ -869,7 +872,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,
@@ -1070,7 +1073,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,
@@ -1172,7 +1175,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_filter_qt_for_gtk, NULL);
gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
if (state->list == NULL) {
@@ -1274,7 +1277,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);
}
if (state->list == NULL) {
@@ -1491,7 +1494,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")) {
@@ -1657,7 +1660,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);
@@ -1824,7 +1827,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);
@@ -2112,7 +2115,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 c1bc18f..3b89639 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]