Commit 30324938 authored by Adrien Plazas's avatar Adrien Plazas
Browse files

Merge branch 'app-ids' into 'pureos/sloppy'

appstream: Force device compatibility via a Phosh setting

See merge request !3
parents 5c1fbd62 06cb14fd
<schemalist>
<schema id="sm.puri.store" path="/sm/puri/store/" gettext-domain="pureos-store">
<key name="compatible-applications" type="as">
<default>[]</default>
<summary>A list of applications to always consider compatible with the device. This is a stop-gap solution until applications are correctly tagged.</summary>
</key>
<key name="compatible-projects" type="as">
<default>['GNOME', 'KDE', 'XFCE']</default>
<summary>A list of compatible projects</summary>
......
......@@ -448,6 +448,29 @@ get_chassis_type (GCancellable *cancellable)
return chassis_type;
}
static gboolean
gs_appstream_is_device_compatibility_forced (GsApp *app)
{
static GHashTable *ids_table = NULL;
if (!ids_table) {
g_autoptr(GSettings) settings = g_settings_new ("sm.puri.phosh");
g_auto(GStrv) ids = g_settings_get_strv (settings, "force-adaptive");
ids_table = g_hash_table_new (g_str_hash, g_str_equal);
if (!ids)
return FALSE;
for (gint i = 0; ids[i]; i++) {
g_hash_table_add (ids_table, g_strdup (ids[i]));
g_hash_table_add (ids_table, g_strdup_printf ("%s.desktop", ids[i]));
}
}
return g_hash_table_contains (ids_table, gs_app_get_id (app));
}
static gboolean
gs_appstream_is_compatible_device (XbNode *component)
{
......@@ -1095,7 +1118,8 @@ gs_appstream_refine_app (GsPlugin *plugin,
}
}
if (gs_appstream_is_compatible_device (component))
if (gs_appstream_is_device_compatibility_forced (app) ||
gs_appstream_is_compatible_device (component))
gs_app_add_kudo (app, GS_APP_KUDO_COMPATIBLE_DEVICE);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment