diff options
author | Richard Hughes <richard@hughsie.com> | 2015-03-04 10:27:14 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2015-03-04 10:27:14 +0000 |
commit | 177061b21dd82a6dbd7e4dc4ba8d0137c3b28ee5 (patch) | |
tree | 78ce0d33563cf5f7e528cec53971619b8e1bc3f4 | |
parent | e23ea1641a6e1dea9c61a4da3a7862d31cf5c3e0 (diff) | |
download | appstream-glib-177061b21dd82a6dbd7e4dc4ba8d0137c3b28ee5.tar.gz |
trivial: Support the ID kind of 'firmware'
This is needed for AppStream 0.9 support.
-rw-r--r-- | libappstream-glib/as-app-validate.c | 1 | ||||
-rw-r--r-- | libappstream-glib/as-app.c | 7 | ||||
-rw-r--r-- | libappstream-glib/as-enums.c | 4 | ||||
-rw-r--r-- | libappstream-glib/as-enums.h | 2 |
4 files changed, 14 insertions, 0 deletions
diff --git a/libappstream-glib/as-app-validate.c b/libappstream-glib/as-app-validate.c index 0ad2a1f..e219697 100644 --- a/libappstream-glib/as-app-validate.c +++ b/libappstream-glib/as-app-validate.c @@ -1107,6 +1107,7 @@ as_app_validate (AsApp *app, AsAppValidateFlags flags, GError **error) case AS_ID_KIND_FONT: case AS_ID_KIND_ADDON: case AS_ID_KIND_SOURCE: + case AS_ID_KIND_FIRMWARE: /* anything goes */ ret = TRUE; default: diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c index 6bc9d74..5480a59 100644 --- a/libappstream-glib/as-app.c +++ b/libappstream-glib/as-app.c @@ -2998,6 +2998,13 @@ as_app_node_insert (AsApp *app, GNode *parent, AsNodeContext *ctx) return NULL; } + /* no firmware allowed here */ + if (api_version < 0.9 && priv->id_kind == AS_ID_KIND_FIRMWARE) { + g_warning ("Not writing firmware '%s' as API version %.1f < 0.9", + priv->id, api_version); + return NULL; + } + /* <component> or <application> */ if (api_version >= 0.6) { node_app = as_node_insert (parent, "component", NULL, 0, NULL); diff --git a/libappstream-glib/as-enums.c b/libappstream-glib/as-enums.c index ee95191..e0bb128 100644 --- a/libappstream-glib/as-enums.c +++ b/libappstream-glib/as-enums.c @@ -59,6 +59,8 @@ as_id_kind_to_string (AsIdKind id_kind) return "source"; if (id_kind == AS_ID_KIND_ADDON) return "addon"; + if (id_kind == AS_ID_KIND_FIRMWARE) + return "firmware"; return "unknown"; } @@ -89,6 +91,8 @@ as_id_kind_from_string (const gchar *id_kind) return AS_ID_KIND_SOURCE; if (g_strcmp0 (id_kind, "addon") == 0) return AS_ID_KIND_ADDON; + if (g_strcmp0 (id_kind, "firmware") == 0) + return AS_ID_KIND_FIRMWARE; return AS_ID_KIND_UNKNOWN; } diff --git a/libappstream-glib/as-enums.h b/libappstream-glib/as-enums.h index ac8010a..e5cbe51 100644 --- a/libappstream-glib/as-enums.h +++ b/libappstream-glib/as-enums.h @@ -40,6 +40,7 @@ G_BEGIN_DECLS * @AS_ID_KIND_WEB_APP: A web appication * @AS_ID_KIND_SOURCE: A software source * @AS_ID_KIND_ADDON: An addon, e.g. a plugin + * @AS_ID_KIND_FIRMWARE: A firmware update * * The ID type. **/ @@ -52,6 +53,7 @@ typedef enum { AS_ID_KIND_WEB_APP, /* Since: 0.1.0 */ AS_ID_KIND_SOURCE, /* Since: 0.1.0 */ AS_ID_KIND_ADDON, /* Since: 0.1.7 */ + AS_ID_KIND_FIRMWARE, /* Since: 0.3.5 */ /*< private >*/ AS_ID_KIND_LAST } AsIdKind; |