summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-03-18 08:52:27 +0000
committerRichard Hughes <richard@hughsie.com>2014-03-18 09:13:25 +0000
commitafcdc8b5df2e48ac8c9c32ac4e1a6469842d6607 (patch)
treee74a2afb22b1cabe532fbd2da019cecf7af24179
parent648e162e687e3e94faaa8b9423f896fe83296b11 (diff)
downloadappstream-glib-afcdc8b5df2e48ac8c9c32ac4e1a6469842d6607.tar.gz
Rename some types that should not be under the AsApp namespace
-rw-r--r--libappstream-glib/Makefile.am2
-rw-r--r--libappstream-glib/appstream-glib.h1
-rw-r--r--libappstream-glib/as-app.c175
-rw-r--r--libappstream-glib/as-app.h49
-rw-r--r--libappstream-glib/as-enums.c160
-rw-r--r--libappstream-glib/as-enums.h72
-rw-r--r--libappstream-glib/as-self-test.c3
-rw-r--r--libappstream-glib/as-store.c4
8 files changed, 266 insertions, 200 deletions
diff --git a/libappstream-glib/Makefile.am b/libappstream-glib/Makefile.am
index dc6f1c5..2c32dd5 100644
--- a/libappstream-glib/Makefile.am
+++ b/libappstream-glib/Makefile.am
@@ -24,6 +24,7 @@ libappstream_glib_includedir = $(includedir)/libappstream-glib
libappstream_glib_include_HEADERS = \
appstream-glib.h \
as-app.h \
+ as-enums.h \
as-image.h \
as-node.h \
as-release.h \
@@ -36,6 +37,7 @@ libappstream_glib_include_HEADERS = \
libappstream_glib_la_SOURCES = \
as-app.c \
as-app-private.h \
+ as-enums.c \
as-image.c \
as-image-private.h \
as-node.c \
diff --git a/libappstream-glib/appstream-glib.h b/libappstream-glib/appstream-glib.h
index 02193fa..1fd72cf 100644
--- a/libappstream-glib/appstream-glib.h
+++ b/libappstream-glib/appstream-glib.h
@@ -25,6 +25,7 @@
#define __APPSTREAM_GLIB_H_INSIDE__
#include <as-app.h>
+#include <as-enums.h>
#include <as-image.h>
#include <as-node.h>
#include <as-release.h>
diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c
index 33a161f..038127f 100644
--- a/libappstream-glib/as-app.c
+++ b/libappstream-glib/as-app.c
@@ -22,6 +22,7 @@
#include "config.h"
#include "as-app-private.h"
+#include "as-enums.h"
#include "as-node-private.h"
#include "as-release-private.h"
#include "as-screenshot-private.h"
@@ -31,8 +32,8 @@
typedef struct _AsAppPrivate AsAppPrivate;
struct _AsAppPrivate
{
- AsAppIconKind icon_kind;
- AsAppIdKind id_kind;
+ AsIconKind icon_kind;
+ AsIdKind id_kind;
GHashTable *comments; /* of locale:string */
GHashTable *descriptions; /* of locale:string */
GHashTable *languages; /* of locale:string */
@@ -145,142 +146,6 @@ as_app_class_init (AsAppClass *klass)
object_class->finalize = as_app_finalize;
}
-/**
- * as_app_id_kind_to_string:
- * @id_kind: the #AsAppIdKind.
- *
- * Converts the enumerated value to an text representation.
- *
- * Returns: string version of @id_kind
- *
- * Since: 0.1.0
- **/
-const gchar *
-as_app_id_kind_to_string (AsAppIdKind id_kind)
-{
- if (id_kind == AS_APP_ID_KIND_DESKTOP)
- return "desktop";
- if (id_kind == AS_APP_ID_KIND_CODEC)
- return "codec";
- if (id_kind == AS_APP_ID_KIND_FONT)
- return "font";
- if (id_kind == AS_APP_ID_KIND_INPUT_METHOD)
- return "inputmethod";
- if (id_kind == AS_APP_ID_KIND_WEB_APP)
- return "webapp";
- if (id_kind == AS_APP_ID_KIND_SOURCE)
- return "source";
- return "unknown";
-}
-
-/**
- * as_app_id_kind_from_string:
- * @id_kind: the string.
- *
- * Converts the text representation to an enumerated value.
- *
- * Returns: a #AsAppIdKind or %AS_APP_ID_KIND_UNKNOWN for unknown
- *
- * Since: 0.1.0
- **/
-AsAppIdKind
-as_app_id_kind_from_string (const gchar *id_kind)
-{
- if (g_strcmp0 (id_kind, "desktop") == 0)
- return AS_APP_ID_KIND_DESKTOP;
- if (g_strcmp0 (id_kind, "codec") == 0)
- return AS_APP_ID_KIND_CODEC;
- if (g_strcmp0 (id_kind, "font") == 0)
- return AS_APP_ID_KIND_FONT;
- if (g_strcmp0 (id_kind, "inputmethod") == 0)
- return AS_APP_ID_KIND_INPUT_METHOD;
- if (g_strcmp0 (id_kind, "webapp") == 0)
- return AS_APP_ID_KIND_WEB_APP;
- if (g_strcmp0 (id_kind, "source") == 0)
- return AS_APP_ID_KIND_SOURCE;
- return AS_APP_ID_KIND_UNKNOWN;
-}
-
-/**
- * as_app_icon_kind_to_string:
- * @icon_kind: the @AsAppIconKind.
- *
- * Converts the enumerated value to an text representation.
- *
- * Returns: string version of @icon_kind
- *
- * Since: 0.1.0
- **/
-const gchar *
-as_app_icon_kind_to_string (AsAppIconKind icon_kind)
-{
- if (icon_kind == AS_APP_ICON_KIND_CACHED)
- return "cached";
- if (icon_kind == AS_APP_ICON_KIND_STOCK)
- return "stock";
- if (icon_kind == AS_APP_ICON_KIND_REMOTE)
- return "remote";
- return "unknown";
-}
-
-/**
- * as_app_icon_kind_from_string:
- * @icon_kind: the string.
- *
- * Converts the text representation to an enumerated value.
- *
- * Returns: a #AsAppIconKind or %AS_APP_ICON_KIND_UNKNOWN for unknown
- *
- * Since: 0.1.0
- **/
-AsAppIconKind
-as_app_icon_kind_from_string (const gchar *icon_kind)
-{
- if (g_strcmp0 (icon_kind, "cached") == 0)
- return AS_APP_ICON_KIND_CACHED;
- if (g_strcmp0 (icon_kind, "stock") == 0)
- return AS_APP_ICON_KIND_STOCK;
- if (g_strcmp0 (icon_kind, "remote") == 0)
- return AS_APP_ICON_KIND_REMOTE;
- return AS_APP_ICON_KIND_UNKNOWN;
-}
-
-/**
- * as_app_url_kind_to_string:
- * @url_kind: the @AsAppUrlKind.
- *
- * Converts the enumerated value to an text representation.
- *
- * Returns: string version of @url_kind
- *
- * Since: 0.1.0
- **/
-const gchar *
-as_app_url_kind_to_string (AsAppUrlKind url_kind)
-{
- if (url_kind == AS_APP_URL_KIND_HOMEPAGE)
- return "homepage";
- return "unknown";
-}
-
-/**
- * as_app_url_kind_from_string:
- * @url_kind: the string.
- *
- * Converts the text representation to an enumerated value.
- *
- * Returns: a #AsAppUrlKind or %AS_APP_URL_KIND_UNKNOWN for unknown
- *
- * Since: 0.1.0
- **/
-AsAppUrlKind
-as_app_url_kind_from_string (const gchar *url_kind)
-{
- if (g_strcmp0 (url_kind, "homepage") == 0)
- return AS_APP_URL_KIND_HOMEPAGE;
- return AS_APP_URL_KIND_UNKNOWN;
-}
-
/******************************************************************************/
/**
@@ -446,7 +311,7 @@ as_app_get_pkgnames (AsApp *app)
*
* Since: 0.1.0
**/
-AsAppIdKind
+AsIdKind
as_app_get_id_kind (AsApp *app)
{
AsAppPrivate *priv = GET_PRIVATE (app);
@@ -463,7 +328,7 @@ as_app_get_id_kind (AsApp *app)
*
* Since: 0.1.0
**/
-AsAppIconKind
+AsIconKind
as_app_get_icon_kind (AsApp *app)
{
AsAppPrivate *priv = GET_PRIVATE (app);
@@ -616,7 +481,7 @@ as_app_get_languages (AsApp *app)
/**
* as_app_get_url_item:
* @app: a #AsApp instance.
- * @url_kind: the URL kind, e.g. %AS_APP_URL_KIND_HOMEPAGE.
+ * @url_kind: the URL kind, e.g. %AS_URL_KIND_HOMEPAGE.
*
* Gets a URL.
*
@@ -625,11 +490,11 @@ as_app_get_languages (AsApp *app)
* Since: 0.1.0
**/
const gchar *
-as_app_get_url_item (AsApp *app, AsAppUrlKind url_kind)
+as_app_get_url_item (AsApp *app, AsUrlKind url_kind)
{
AsAppPrivate *priv = GET_PRIVATE (app);
return g_hash_table_lookup (priv->urls,
- as_app_url_kind_to_string (url_kind));
+ as_url_kind_to_string (url_kind));
}
/**
@@ -713,14 +578,14 @@ as_app_set_id_full (AsApp *app, const gchar *id_full, gssize id_full_len)
/**
* as_app_set_id_kind:
* @app: a #AsApp instance.
- * @id_kind: the #AsAppIdKind.
+ * @id_kind: the #AsIdKind.
*
* Sets the application kind.
*
* Since: 0.1.0
**/
void
-as_app_set_id_kind (AsApp *app, AsAppIdKind id_kind)
+as_app_set_id_kind (AsApp *app, AsIdKind id_kind)
{
AsAppPrivate *priv = GET_PRIVATE (app);
priv->id_kind = id_kind;
@@ -805,14 +670,14 @@ as_app_set_icon_path (AsApp *app, const gchar *icon_path, gssize icon_path_len)
/**
* as_app_set_icon_kind:
* @app: a #AsApp instance.
- * @icon_kind: the #AsAppIconKind.
+ * @icon_kind: the #AsIconKind.
*
* Sets the icon kind.
*
* Since: 0.1.0
**/
void
-as_app_set_icon_kind (AsApp *app, AsAppIconKind icon_kind)
+as_app_set_icon_kind (AsApp *app, AsIconKind icon_kind)
{
AsAppPrivate *priv = GET_PRIVATE (app);
priv->icon_kind = icon_kind;
@@ -1095,7 +960,7 @@ as_app_add_language (AsApp *app,
/**
* as_app_add_url:
* @app: a #AsApp instance.
- * @url_kind: the URL kind, e.g. %AS_APP_URL_KIND_HOMEPAGE
+ * @url_kind: the URL kind, e.g. %AS_URL_KIND_HOMEPAGE
* @url: the full URL.
* @url_len: the size of @url, or -1 if %NULL-terminated.
*
@@ -1105,13 +970,13 @@ as_app_add_language (AsApp *app,
**/
void
as_app_add_url (AsApp *app,
- AsAppUrlKind url_kind,
+ AsUrlKind url_kind,
const gchar *url,
gssize url_len)
{
AsAppPrivate *priv = GET_PRIVATE (app);
g_hash_table_insert (priv->urls,
- g_strdup (as_app_url_kind_to_string (url_kind)),
+ g_strdup (as_url_kind_to_string (url_kind)),
as_strndup (url, url_len));
}
@@ -1263,7 +1128,7 @@ as_app_node_insert (AsApp *app, GNode *parent)
/* <id> */
as_node_insert (node_app, "id", priv->id_full, 0,
- "type", as_app_id_kind_to_string (priv->id_kind),
+ "type", as_id_kind_to_string (priv->id_kind),
NULL);
/* <priority> */
@@ -1292,7 +1157,7 @@ as_app_node_insert (AsApp *app, GNode *parent)
/* <icon> */
if (priv->icon != NULL) {
as_node_insert (node_app, "icon", priv->icon, 0,
- "type", as_app_icon_kind_to_string (priv->icon_kind),
+ "type", as_icon_kind_to_string (priv->icon_kind),
NULL);
}
@@ -1400,7 +1265,7 @@ as_app_node_parse_child (AsApp *app, GNode *n, GError **error)
/* <id> */
case AS_TAG_ID:
tmp = as_node_get_attribute (n, "type");
- as_app_set_id_kind (app, as_app_id_kind_from_string (tmp));
+ as_app_set_id_kind (app, as_id_kind_from_string (tmp));
as_app_set_id_full (app, as_node_get_data (n), -1);
break;
@@ -1447,7 +1312,7 @@ as_app_node_parse_child (AsApp *app, GNode *n, GError **error)
/* <icon> */
case AS_TAG_ICON:
tmp = as_node_get_attribute (n, "type");
- as_app_set_icon_kind (app, as_app_icon_kind_from_string (tmp));
+ as_app_set_icon_kind (app, as_icon_kind_from_string (tmp));
g_free (priv->icon);
priv->icon = as_node_take_data (n);
break;
@@ -1495,7 +1360,7 @@ as_app_node_parse_child (AsApp *app, GNode *n, GError **error)
case AS_TAG_URL:
tmp = as_node_get_attribute (n, "type");
as_app_add_url (app,
- as_app_url_kind_from_string (tmp),
+ as_url_kind_from_string (tmp),
as_node_get_data (n), -1);
break;
diff --git a/libappstream-glib/as-app.h b/libappstream-glib/as-app.h
index 60d753a..0d7d46d 100644
--- a/libappstream-glib/as-app.h
+++ b/libappstream-glib/as-app.h
@@ -28,6 +28,7 @@
#include <glib-object.h>
+#include "as-enums.h"
#include "as-release.h"
#include "as-screenshot.h"
@@ -62,48 +63,12 @@ struct _AsAppClass
void (*_as_reserved8) (void);
};
-typedef enum {
- AS_APP_ICON_KIND_UNKNOWN,
- AS_APP_ICON_KIND_STOCK,
- AS_APP_ICON_KIND_CACHED,
- AS_APP_ICON_KIND_REMOTE,
- /*< private >*/
- AS_APP_ICON_KIND_LAST
-} AsAppIconKind;
-
-typedef enum {
- AS_APP_ID_KIND_UNKNOWN,
- AS_APP_ID_KIND_DESKTOP,
- AS_APP_ID_KIND_FONT,
- AS_APP_ID_KIND_CODEC,
- AS_APP_ID_KIND_INPUT_METHOD,
- AS_APP_ID_KIND_WEB_APP,
- AS_APP_ID_KIND_SOURCE,
- /*< private >*/
- AS_APP_ID_KIND_LAST
-} AsAppIdKind;
-
-typedef enum {
- AS_APP_URL_KIND_UNKNOWN,
- AS_APP_URL_KIND_HOMEPAGE,
- /*< private >*/
- AS_APP_URL_KIND_LAST
-} AsAppUrlKind;
-
GType as_app_get_type (void);
AsApp *as_app_new (void);
-/* helpers */
-const gchar *as_app_id_kind_to_string (AsAppIdKind id_kind);
-AsAppIdKind as_app_id_kind_from_string (const gchar *id_kind);
-const gchar *as_app_icon_kind_to_string (AsAppIconKind icon_kind);
-AsAppIconKind as_app_icon_kind_from_string (const gchar *icon_kind);
-const gchar *as_app_url_kind_to_string (AsAppUrlKind url_kind);
-AsAppUrlKind as_app_url_kind_from_string (const gchar *url_kind);
-
/* getters */
-AsAppIconKind as_app_get_icon_kind (AsApp *app);
-AsAppIdKind as_app_get_id_kind (AsApp *app);
+AsIconKind as_app_get_icon_kind (AsApp *app);
+AsIdKind as_app_get_id_kind (AsApp *app);
GList *as_app_get_languages (AsApp *app);
GPtrArray *as_app_get_categories (AsApp *app);
GPtrArray *as_app_get_compulsory_for_desktops (AsApp *app);
@@ -130,14 +95,14 @@ gint as_app_get_language (AsApp *app,
const gchar *as_app_get_metadata_item (AsApp *app,
const gchar *key);
const gchar *as_app_get_url_item (AsApp *app,
- AsAppUrlKind url_kind);
+ AsUrlKind url_kind);
/* setters */
void as_app_set_id_full (AsApp *app,
const gchar *id_full,
gssize id_full_len);
void as_app_set_id_kind (AsApp *app,
- AsAppIdKind id_kind);
+ AsIdKind id_kind);
void as_app_set_project_group (AsApp *app,
const gchar *project_group,
gssize project_group_len);
@@ -151,7 +116,7 @@ void as_app_set_icon_path (AsApp *app,
const gchar *icon_path,
gssize icon_path_len);
void as_app_set_icon_kind (AsApp *app,
- AsAppIconKind icon_kind);
+ AsIconKind icon_kind);
void as_app_set_name (AsApp *app,
const gchar *locale,
const gchar *name,
@@ -190,7 +155,7 @@ void as_app_add_compulsory_for_desktop (AsApp *app,
const gchar *compulsory_for_desktop,
gssize compulsory_for_desktop_len);
void as_app_add_url (AsApp *app,
- AsAppUrlKind url_kind,
+ AsUrlKind url_kind,
const gchar *url,
gssize url_len);
void as_app_add_metadata (AsApp *app,
diff --git a/libappstream-glib/as-enums.c b/libappstream-glib/as-enums.c
new file mode 100644
index 0000000..95cadc0
--- /dev/null
+++ b/libappstream-glib/as-enums.c
@@ -0,0 +1,160 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2014 Richard Hughes <richard@hughsie.com>
+ *
+ * Licensed under the GNU Lesser General Public License Version 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+
+#include "as-enums.h"
+
+/**
+ * as_id_kind_to_string:
+ * @id_kind: the #AsIdKind.
+ *
+ * Converts the enumerated value to an text representation.
+ *
+ * Returns: string version of @id_kind
+ *
+ * Since: 0.1.0
+ **/
+const gchar *
+as_id_kind_to_string (AsIdKind id_kind)
+{
+ if (id_kind == AS_ID_KIND_DESKTOP)
+ return "desktop";
+ if (id_kind == AS_ID_KIND_CODEC)
+ return "codec";
+ if (id_kind == AS_ID_KIND_FONT)
+ return "font";
+ if (id_kind == AS_ID_KIND_INPUT_METHOD)
+ return "inputmethod";
+ if (id_kind == AS_ID_KIND_WEB_APP)
+ return "webapp";
+ if (id_kind == AS_ID_KIND_SOURCE)
+ return "source";
+ return "unknown";
+}
+
+/**
+ * as_id_kind_from_string:
+ * @id_kind: the string.
+ *
+ * Converts the text representation to an enumerated value.
+ *
+ * Returns: a #AsIdKind or %AS_ID_KIND_UNKNOWN for unknown
+ *
+ * Since: 0.1.0
+ **/
+AsIdKind
+as_id_kind_from_string (const gchar *id_kind)
+{
+ if (g_strcmp0 (id_kind, "desktop") == 0)
+ return AS_ID_KIND_DESKTOP;
+ if (g_strcmp0 (id_kind, "codec") == 0)
+ return AS_ID_KIND_CODEC;
+ if (g_strcmp0 (id_kind, "font") == 0)
+ return AS_ID_KIND_FONT;
+ if (g_strcmp0 (id_kind, "inputmethod") == 0)
+ return AS_ID_KIND_INPUT_METHOD;
+ if (g_strcmp0 (id_kind, "webapp") == 0)
+ return AS_ID_KIND_WEB_APP;
+ if (g_strcmp0 (id_kind, "source") == 0)
+ return AS_ID_KIND_SOURCE;
+ return AS_ID_KIND_UNKNOWN;
+}
+
+/**
+ * as_icon_kind_to_string:
+ * @icon_kind: the @AsIconKind.
+ *
+ * Converts the enumerated value to an text representation.
+ *
+ * Returns: string version of @icon_kind
+ *
+ * Since: 0.1.0
+ **/
+const gchar *
+as_icon_kind_to_string (AsIconKind icon_kind)
+{
+ if (icon_kind == AS_ICON_KIND_CACHED)
+ return "cached";
+ if (icon_kind == AS_ICON_KIND_STOCK)
+ return "stock";
+ if (icon_kind == AS_ICON_KIND_REMOTE)
+ return "remote";
+ return "unknown";
+}
+
+/**
+ * as_icon_kind_from_string:
+ * @icon_kind: the string.
+ *
+ * Converts the text representation to an enumerated value.
+ *
+ * Returns: a #AsIconKind or %AS_ICON_KIND_UNKNOWN for unknown
+ *
+ * Since: 0.1.0
+ **/
+AsIconKind
+as_icon_kind_from_string (const gchar *icon_kind)
+{
+ if (g_strcmp0 (icon_kind, "cached") == 0)
+ return AS_ICON_KIND_CACHED;
+ if (g_strcmp0 (icon_kind, "stock") == 0)
+ return AS_ICON_KIND_STOCK;
+ if (g_strcmp0 (icon_kind, "remote") == 0)
+ return AS_ICON_KIND_REMOTE;
+ return AS_ICON_KIND_UNKNOWN;
+}
+
+/**
+ * as_url_kind_to_string:
+ * @url_kind: the @AsUrlKind.
+ *
+ * Converts the enumerated value to an text representation.
+ *
+ * Returns: string version of @url_kind
+ *
+ * Since: 0.1.0
+ **/
+const gchar *
+as_url_kind_to_string (AsUrlKind url_kind)
+{
+ if (url_kind == AS_URL_KIND_HOMEPAGE)
+ return "homepage";
+ return "unknown";
+}
+
+/**
+ * as_url_kind_from_string:
+ * @url_kind: the string.
+ *
+ * Converts the text representation to an enumerated value.
+ *
+ * Returns: a #AsUrlKind or %AS_URL_KIND_UNKNOWN for unknown
+ *
+ * Since: 0.1.0
+ **/
+AsUrlKind
+as_url_kind_from_string (const gchar *url_kind)
+{
+ if (g_strcmp0 (url_kind, "homepage") == 0)
+ return AS_URL_KIND_HOMEPAGE;
+ return AS_URL_KIND_UNKNOWN;
+}
diff --git a/libappstream-glib/as-enums.h b/libappstream-glib/as-enums.h
new file mode 100644
index 0000000..5521fc9
--- /dev/null
+++ b/libappstream-glib/as-enums.h
@@ -0,0 +1,72 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2014 Richard Hughes <richard@hughsie.com>
+ *
+ * Licensed under the GNU Lesser General Public License Version 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#if !defined (__APPSTREAM_GLIB_H) && !defined (AS_COMPILATION)
+#error "Only <appstream-glib.h> can be included directly."
+#endif
+
+#ifndef __AS_ENUMS_H
+#define __AS_ENUMS_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+ AS_ID_KIND_UNKNOWN,
+ AS_ID_KIND_DESKTOP,
+ AS_ID_KIND_FONT,
+ AS_ID_KIND_CODEC,
+ AS_ID_KIND_INPUT_METHOD,
+ AS_ID_KIND_WEB_APP,
+ AS_ID_KIND_SOURCE,
+ /*< private >*/
+ AS_ID_KIND_LAST
+} AsIdKind;
+
+typedef enum {
+ AS_ICON_KIND_UNKNOWN,
+ AS_ICON_KIND_STOCK,
+ AS_ICON_KIND_CACHED,
+ AS_ICON_KIND_REMOTE,
+ /*< private >*/
+ AS_ICON_KIND_LAST
+} AsIconKind;
+
+typedef enum {
+ AS_URL_KIND_UNKNOWN,
+ AS_URL_KIND_HOMEPAGE,
+ /*< private >*/
+ AS_URL_KIND_LAST
+} AsUrlKind;
+
+const gchar *as_id_kind_to_string (AsIdKind id_kind);
+AsIdKind as_id_kind_from_string (const gchar *id_kind);
+
+const gchar *as_icon_kind_to_string (AsIconKind icon_kind);
+AsIconKind as_icon_kind_from_string (const gchar *icon_kind);
+
+const gchar *as_url_kind_to_string (AsUrlKind url_kind);
+AsUrlKind as_url_kind_from_string (const gchar *url_kind);
+
+G_END_DECLS
+
+#endif /* __AS_ENUMS_H */
diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c
index dbc5eeb..c5e67ec 100644
--- a/libappstream-glib/as-self-test.c
+++ b/libappstream-glib/as-self-test.c
@@ -24,6 +24,7 @@
#include <glib.h>
#include "as-app-private.h"
+#include "as-enums.h"
#include "as-image-private.h"
#include "as-node-private.h"
#include "as-release-private.h"
@@ -270,7 +271,7 @@ ch_test_app_func (void)
g_assert_cmpstr (as_app_get_name (app, "pl"), ==, "Oprogramowanie");
g_assert_cmpstr (as_app_get_comment (app, NULL), ==, "Application manager");
g_assert_cmpstr (as_app_get_icon (app), ==, "org.gnome.Software.png");
- g_assert_cmpint (as_app_get_icon_kind (app), ==, AS_APP_ICON_KIND_CACHED);
+ g_assert_cmpint (as_app_get_icon_kind (app), ==, AS_ICON_KIND_CACHED);
g_assert_cmpstr (as_app_get_project_group (app), ==, "GNOME");
g_assert_cmpstr (as_app_get_project_license (app), ==, "GPLv2+");
g_assert_cmpint (as_app_get_categories(app)->len, ==, 1);
diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c
index a11aa8b..0488f31 100644
--- a/libappstream-glib/as-store.c
+++ b/libappstream-glib/as-store.c
@@ -163,7 +163,7 @@ static void
as_store_add_app (AsStore *store, AsApp *app)
{
AsApp *item;
- AsAppIdKind id_kind;
+ AsIdKind id_kind;
AsStorePrivate *priv = GET_PRIVATE (store);
GPtrArray *pkgnames;
const gchar *id;
@@ -192,7 +192,7 @@ as_store_add_app (AsStore *store, AsApp *app)
/* this is a type we don't know how to handle */
id_kind = as_app_get_id_kind (app);
- if (id_kind == AS_APP_ID_KIND_UNKNOWN) {
+ if (id_kind == AS_ID_KIND_UNKNOWN) {
g_debug ("No idea how to handle AppStream entry: %s", id);
g_object_unref (app);
return;