[gnome-software] Add a setting to be able to test filting applications by missing appdata
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add a setting to be able to test filting applications by missing appdata
- Date: Mon, 4 Nov 2013 13:13:09 +0000 (UTC)
commit 655c8a72413d4aaaa35a145c60f2b7f7e230c616
Author: Richard Hughes <richard hughsie com>
Date: Mon Nov 4 12:54:04 2013 +0000
Add a setting to be able to test filting applications by missing appdata
This is much easier to test as a setting rather than getting people to recompile
the application. It also gets us much closer to what the GNOME designers want
in vision, where we only show high quality applications with screenshots and
long descriptions.
We're not at the point where we can turn this on by default yet, but it's what
we're threatening to do for GNOME 3.14
data/org.gnome.software.gschema.xml | 5 +++++
src/gs-plugin-loader.c | 16 ++++++++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.software.gschema.xml b/data/org.gnome.software.gschema.xml
index fbdc8ee..a017386 100644
--- a/data/org.gnome.software.gschema.xml
+++ b/data/org.gnome.software.gschema.xml
@@ -5,5 +5,10 @@
<summary>A list of compatible projects</summary>
<description>This is a list of compatible projects we should show such as GNOME, KDE and
XFCE.</description>
</key>
+ <key name="require-appdata" type="b">
+ <default>false</default>
+ <summary>Applications require AppData to be shown in the search results</summary>
+ <description>If enabled applications require a long description before they are shown to the user in
the search results.</description>
+ </key>
</schema>
</schemalist>
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index d96c756..946b5ad 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -490,6 +490,17 @@ gs_plugin_loader_get_app_is_compatible (GsApp *app, gpointer user_data)
return FALSE;
}
+/**
+ * gs_plugin_loader_get_app_has_appdata:
+ */
+static gboolean
+gs_plugin_loader_get_app_has_appdata (GsApp *app, gpointer user_data)
+{
+ if (gs_app_get_description (app) != NULL)
+ return TRUE;
+ g_debug ("removing app with no AppData %s", gs_app_get_id (app));
+ return FALSE;
+}
/**
* gs_plugin_loader_run_action_plugin:
@@ -1373,6 +1384,11 @@ gs_plugin_loader_search_thread_cb (GSimpleAsyncResult *res,
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_get_app_is_compatible, plugin_loader);
+ if (g_settings_get_boolean (plugin_loader->priv->settings, "require-appdata")) {
+ gs_plugin_list_filter (&state->list,
+ gs_plugin_loader_get_app_has_appdata,
+ plugin_loader);
+ }
if (state->list == NULL) {
g_set_error (&error,
GS_PLUGIN_LOADER_ERROR,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]