[gnome-software] Port to using Appstream-Glib in the AppStream and AppData plugins



commit 924f70a16c99c0edbad1b777e70e372ed22bf51f
Author: Richard Hughes <richard hughsie com>
Date:   Wed Mar 12 21:08:51 2014 +0000

    Port to using Appstream-Glib in the AppStream and AppData plugins
    
    This adds a new hard dep, but removes a ton of code. You can find information
    about this lib here: http://people.freedesktop.org/~hughsient/appstream-glib/

 configure.ac                       |    1 +
 src/plugins/Makefile.am            |   25 +-
 src/plugins/appstream-app.c        |  666 -----------------------
 src/plugins/appstream-app.h        |  148 -----
 src/plugins/appstream-cache.c      | 1056 ------------------------------------
 src/plugins/appstream-cache.h      |   76 ---
 src/plugins/appstream-common.c     |  298 ----------
 src/plugins/appstream-common.h     |   72 ---
 src/plugins/appstream-image.c      |  139 -----
 src/plugins/appstream-image.h      |   59 --
 src/plugins/appstream-markup.c     |  242 --------
 src/plugins/appstream-markup.h     |   64 ---
 src/plugins/appstream-screenshot.c |  139 -----
 src/plugins/appstream-screenshot.h |   60 --
 src/plugins/gs-plugin-appdata.c    |  275 +++-------
 src/plugins/gs-plugin-appstream.c  |  295 ++++++-----
 src/plugins/gs-self-test.c         |  116 ----
 17 files changed, 235 insertions(+), 3496 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d6b2901..27edcea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,6 +63,7 @@ dnl - Check library dependencies
 dnl ---------------------------------------------------------------------------
 PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.11.5 gio-unix-2.0)
 PKG_CHECK_MODULES(PACKAGEKIT, packagekit-glib2 >= 0.8.12)
+PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.1.1)
 PKG_CHECK_MODULES(SQLITE, sqlite3)
 PKG_CHECK_MODULES(NOTIFY, libnotify)
 PKG_CHECK_MODULES(SOUP, libsoup-2.4)
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 18de85b..737cc60 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -2,6 +2,7 @@
 AUTOMAKE_OPTIONS = 1.7
 
 AM_CPPFLAGS =                                          \
+       $(APPSTREAM_CFLAGS)                             \
        $(GLIB_CFLAGS)                                  \
        $(GTK_CFLAGS)                                   \
        $(SQLITE_CFLAGS)                                \
@@ -75,30 +76,14 @@ libgs_plugin_self_test_la_LDFLAGS = -module -avoid-version
 libgs_plugin_self_test_la_CFLAGS = $(GS_PLUGIN_CFLAGS) $(WARN_CFLAGS)
 
 libgs_plugin_appstream_la_SOURCES =                    \
-       gs-plugin-appstream.c                           \
-       appstream-app.c                                 \
-       appstream-app.h                                 \
-       appstream-image.c                               \
-       appstream-image.h                               \
-       appstream-screenshot.c                          \
-       appstream-screenshot.h                          \
-       appstream-common.c                              \
-       appstream-common.h                              \
-       appstream-markup.c                              \
-       appstream-markup.h                              \
-       appstream-cache.c                               \
-       appstream-cache.h
-libgs_plugin_appstream_la_LIBADD = $(GS_PLUGIN_LIBS)
+       gs-plugin-appstream.c
+libgs_plugin_appstream_la_LIBADD = $(GS_PLUGIN_LIBS) $(APPSTREAM_LIBS)
 libgs_plugin_appstream_la_LDFLAGS = -module -avoid-version
 libgs_plugin_appstream_la_CFLAGS = $(GS_PLUGIN_CFLAGS) $(WARN_CFLAGS)
 
 libgs_plugin_appdata_la_SOURCES =                      \
-       appstream-common.c                              \
-       appstream-common.h                              \
-       appstream-markup.c                              \
-       appstream-markup.h                              \
        gs-plugin-appdata.c
-libgs_plugin_appdata_la_LIBADD = $(GS_PLUGIN_LIBS)
+libgs_plugin_appdata_la_LIBADD = $(GS_PLUGIN_LIBS) $(APPSTREAM_LIBS)
 libgs_plugin_appdata_la_LDFLAGS = -module -avoid-version
 libgs_plugin_appdata_la_CFLAGS = $(GS_PLUGIN_CFLAGS) $(WARN_CFLAGS)
 
@@ -220,8 +205,6 @@ check_PROGRAMS =                                    \
        gs-self-test
 
 gs_self_test_SOURCES =                                 \
-       appstream-common.c                              \
-       appstream-markup.c                              \
        gs-moduleset.c                                  \
        gs-self-test.c
 
diff --git a/src/plugins/gs-plugin-appdata.c b/src/plugins/gs-plugin-appdata.c
index 972a3a1..930c1ff 100644
--- a/src/plugins/gs-plugin-appdata.c
+++ b/src/plugins/gs-plugin-appdata.c
@@ -23,8 +23,7 @@
 
 #include <gs-plugin.h>
 
-#include "appstream-common.h"
-#include "appstream-markup.h"
+#include <appstream-glib.h>
 
 struct GsPluginPrivate {
        gchar                   *cachedir;
@@ -122,185 +121,23 @@ out:
        return ret;
 }
 
-typedef struct {
-       AppstreamTag             tag;
-       GsApp                   *app;
-       AppstreamMarkup         *markup;
-} AppstreamCacheHelper;
-
-/**
- * appdata_parse_start_element_cb:
- */
-static void
-appdata_parse_start_element_cb (GMarkupParseContext *context,
-                               const gchar *element_name,
-                               const gchar **attribute_names,
-                               const gchar **attribute_values,
-                               gpointer user_data,
-                               GError **error)
-{
-       AppstreamCacheHelper *helper = (AppstreamCacheHelper *) user_data;
-       guint i;
-
-       /* description markup */
-       if (helper->tag == APPSTREAM_TAG_DESCRIPTION) {
-               for (i = 0; attribute_names[i] != NULL; i++) {
-                       if (g_strcmp0 (attribute_names[i], "xml:lang") == 0) {
-                               appstream_markup_set_lang (helper->markup,
-                                                          attribute_values[i]);
-                               break;
-                       }
-               }
-               if (g_strcmp0 (element_name, "p") == 0) {
-                       appstream_markup_set_mode (helper->markup,
-                                                  APPSTREAM_MARKUP_MODE_P_START);
-               } else if (g_strcmp0 (element_name, "ul") == 0) {
-                       appstream_markup_set_mode (helper->markup,
-                                                  APPSTREAM_MARKUP_MODE_UL_START);
-               } else if (g_strcmp0 (element_name, "li") == 0) {
-                       appstream_markup_set_mode (helper->markup,
-                                                  APPSTREAM_MARKUP_MODE_LI_START);
-               }
-               return;
-       }
-
-       helper->tag = appstream_tag_from_string (element_name);
-       switch (helper->tag) {
-       case APPSTREAM_TAG_DESCRIPTION:
-               /* only process the description if it's not already been set;
-                * doing all this string munging is moderately expensive */
-               appstream_markup_set_enabled (helper->markup,
-                                             gs_app_get_description (helper->app) == NULL);
-               appstream_markup_set_mode (helper->markup,
-                                          APPSTREAM_MARKUP_MODE_START);
-               break;
-       case APPSTREAM_TAG_UNKNOWN:
-               g_warning ("AppData: tag %s unknown", element_name);
-               break;
-       default:
-               break;
-       }
-}
-
-
 /**
- * appdata_parse_end_element_cb:
+ * gs_plugin_appdata_get_best_locale:
  */
-static void
-appdata_parse_end_element_cb (GMarkupParseContext *context,
-                             const gchar *element_name,
-                             gpointer user_data,
-                             GError **error)
+static const gchar *
+gs_plugin_appdata_get_best_locale (GHashTable *locale_hash)
 {
+       const gchar * const *locales;
        const gchar *tmp;
-       AppstreamCacheHelper *helper = (AppstreamCacheHelper *) user_data;
-       if (helper->tag == APPSTREAM_TAG_DESCRIPTION) {
-               if (g_strcmp0 (element_name, "p") == 0) {
-                       appstream_markup_set_mode (helper->markup,
-                                                  APPSTREAM_MARKUP_MODE_P_END);
-               } else if (g_strcmp0 (element_name, "ul") == 0) {
-                       appstream_markup_set_mode (helper->markup,
-                                                  APPSTREAM_MARKUP_MODE_UL_END);
-               } else if (g_strcmp0 (element_name, "li") == 0) {
-                       appstream_markup_set_mode (helper->markup,
-                                                  APPSTREAM_MARKUP_MODE_LI_END);
-               } else if (g_strcmp0 (element_name, "description") == 0) {
-                       appstream_markup_set_mode (helper->markup,
-                                                  APPSTREAM_MARKUP_MODE_END);
-                       tmp = appstream_markup_get_text (helper->markup);
-                       if (tmp != NULL)
-                               gs_app_set_description (helper->app,
-                                                       GS_APP_QUALITY_NORMAL,
-                                                       tmp);
-                       helper->tag = APPSTREAM_TAG_APPLICATION;
-               }
-       } else {
-               helper->tag = APPSTREAM_TAG_APPLICATION;
-       }
-}
-
-/**
- * appdata_parse_text_cb:
- */
-static void
-appdata_parse_text_cb (GMarkupParseContext *context,
-                       const gchar *text,
-                       gsize text_len,
-                       gpointer user_data,
-                       GError **error)
-{
-       AppstreamCacheHelper *helper = (AppstreamCacheHelper *) user_data;
-       gchar *tmp = NULL;
-
-       /* no useful content */
-       if (text_len == 0)
-               return;
+       guint i;
 
-       switch (helper->tag) {
-       case APPSTREAM_TAG_APPLICATION:
-       case APPSTREAM_TAG_APPLICATIONS:
-       case APPSTREAM_TAG_ID:
-       case APPSTREAM_TAG_PROJECT_LICENSE:
-       case APPSTREAM_TAG_SCREENSHOTS:
-       case APPSTREAM_TAG_UPDATECONTACT:
-       case APPSTREAM_TAG_COMPULSORY_FOR_DESKTOP:
-               /* ignore */
-               break;
-       case APPSTREAM_TAG_DESCRIPTION:
-               appstream_markup_add_content (helper->markup, text, text_len);
-               break;
-       case APPSTREAM_TAG_SCREENSHOT:
-               gs_app_add_kudo (helper->app, GS_APP_KUDO_HAS_SCREENSHOTS);
-               /* FIXME: actually add to API */
-               //tmp = appstream_xml_unmunge (text, text_len);
-               //gs_app_add_screenshot (helper->app, tmp);
-               break;
-       case APPSTREAM_TAG_NAME:
-               // FIXME: does not get best language
-               tmp = appstream_xml_unmunge (text, text_len);
-               if (tmp == NULL)
-                       break;
-               g_debug ("AppData: Setting name: %s", tmp);
-               gs_app_set_name (helper->app, GS_APP_QUALITY_NORMAL, tmp);
-               break;
-       case APPSTREAM_TAG_SUMMARY:
-               // FIXME: does not get best language
-               tmp = appstream_xml_unmunge (text, text_len);
-               if (tmp == NULL)
-                       break;
-               g_debug ("AppData: Setting summary: %s", tmp);
-               gs_app_set_summary (helper->app, GS_APP_QUALITY_NORMAL, tmp);
-               break;
-       case APPSTREAM_TAG_URL:
-               if (gs_app_get_url (helper->app, GS_APP_URL_KIND_HOMEPAGE) == NULL) {
-                       tmp = appstream_xml_unmunge (text, text_len);
-                       if (tmp == NULL)
-                               break;
-                       g_debug ("AppData: Setting URL: %s", tmp);
-                       gs_app_set_url (helper->app, GS_APP_URL_KIND_HOMEPAGE, tmp);
-               }
-               break;
-       case APPSTREAM_TAG_PROJECT_GROUP:
-               if (gs_app_get_project_group (helper->app) == NULL) {
-                       tmp = appstream_xml_unmunge (text, text_len);
-                       if (tmp == NULL)
-                               break;
-                       g_debug ("AppData: Setting project-group: %s", tmp);
-                       gs_app_set_project_group (helper->app, tmp);
-               }
-               break;
-       default:
-               tmp = appstream_xml_unmunge (text, text_len);
-               if (tmp == NULL)
-                       break;
-               if (helper->tag != APPSTREAM_TAG_UNKNOWN) {
-                       g_warning ("AppData: unknown data '%s' is '%s'",
-                                  appstream_tag_to_string (helper->tag), tmp);
-               }
-               break;
+       locales = g_get_language_names ();
+       for (i = 0; locales[i] != NULL; i++) {
+               tmp = g_hash_table_lookup (locale_hash, locales[i]);
+               if (tmp != NULL)
+                       return tmp;
        }
-       g_free (tmp);
-
+       return NULL;
 }
 
 /**
@@ -311,40 +148,80 @@ gs_plugin_refine_by_local_appdata (GsApp *app,
                                   const gchar *filename,
                                   GError **error)
 {
-       const GMarkupParser parser = {
-               appdata_parse_start_element_cb,
-               appdata_parse_end_element_cb,
-               appdata_parse_text_cb,
-               NULL /* passthrough */,
-               NULL /* error */ };
-       AppstreamCacheHelper *helper = NULL;
-       gchar *data;
+       GHashTable *description = NULL;
+       GNode *application;
+       GNode *n;
+       GNode *root = NULL;
+       const gchar *tmp;
        gboolean ret;
-       GMarkupParseContext *ctx = NULL;
+       gchar *data = NULL;
+       gchar *desc = NULL;
 
        /* read file */
        ret = g_file_get_contents (filename, &data, NULL, error);
        if (!ret)
                goto out;
+       root = as_node_from_xml (data, -1, AS_NODE_FROM_XML_FLAG_NONE, error);
+       if (root == NULL) {
+               ret = FALSE;
+               goto out;
+       }
 
-       /* parse file */
-       helper = g_new0 (AppstreamCacheHelper, 1);
-       helper->app = app;
-       helper->markup = appstream_markup_new ();
-       ctx = g_markup_parse_context_new (&parser,
-                                         G_MARKUP_PREFIX_ERROR_POSITION,
-                                         helper,
-                                         NULL);
-       ret = g_markup_parse_context_parse (ctx, data, -1, error);
-       if (!ret)
+       /* parse content */
+       application = as_node_find (root, "application");
+       if (application == NULL)
                goto out;
+
+       /* <name> */
+       tmp = as_node_get_localized_best (application, "name");
+       if (tmp != NULL)
+               gs_app_set_name (app, GS_APP_QUALITY_NORMAL, tmp);
+
+       /* <summary> */
+       tmp = as_node_get_localized_best (application, "summary");
+       if (tmp != NULL)
+               gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, tmp);
+
+       /* <screenshots> */
+       n = as_node_find (application, "screenshots");
+       if (n != NULL)
+               gs_app_add_kudo (app, GS_APP_KUDO_HAS_SCREENSHOTS);
+
+       /* <url> */
+       n = as_node_find (root, "url");
+       if (n != NULL && gs_app_get_url (app, GS_APP_URL_KIND_HOMEPAGE) == NULL) {
+               gs_app_set_url (app, GS_APP_URL_KIND_HOMEPAGE,
+                               as_node_get_data (n));
+       }
+
+       /* <project_group> */
+       n = as_node_find (application, "project_group");
+       if (n != NULL && gs_app_get_project_group (app) == NULL)
+               gs_app_set_project_group (app, as_node_get_data (n));
+
+       /* <description> */
+       n = as_node_find (application, "description");
+       if (n != NULL) {
+               description = as_node_get_localized_unwrap (n, error);
+               if (description == NULL) {
+                       ret = FALSE;
+                       goto out;
+               }
+               tmp = gs_plugin_appdata_get_best_locale (description);
+               desc = as_markup_convert_simple (tmp, -1, error);
+               if (desc == NULL) {
+                       ret = FALSE;
+                       goto out;
+               }
+               gs_app_set_description (app, GS_APP_QUALITY_NORMAL, desc);
+       }
 out:
-       if (ctx != NULL)
-               g_markup_parse_context_free (ctx);
-       if (helper != NULL)
-               appstream_markup_free (helper->markup);
-       g_free (helper);
+       if (root != NULL)
+               as_node_unref (root);
+       if (description != NULL)
+               g_hash_table_unref (description);
        g_free (data);
+       g_free (desc);
        return ret;
 }
 
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 4f37496..cd00512 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -22,17 +22,15 @@
 #include <config.h>
 #include <glib/gi18n.h>
 #include <locale.h>
+#include <appstream-glib.h>
 
 #include <gs-plugin.h>
 #include <gs-plugin-loader.h>
 
-#include "appstream-app.h"
-#include "appstream-cache.h"
-
 #define        GS_PLUGIN_APPSTREAM_MAX_SCREENSHOTS     5
 
 struct GsPluginPrivate {
-       AppstreamCache          *cache;
+       AsStore                 *store;
        GPtrArray               *file_monitors;
        gchar                   *locale;
        gchar                   *cachedir;
@@ -49,26 +47,41 @@ gs_plugin_get_name (void)
 }
 
 /**
- * gs_plugin_appstream_icons_are_new_layout:
+ * as_app_has_category:
  */
 static gboolean
-gs_plugin_appstream_icons_are_new_layout (const gchar *dirname)
+as_app_has_category (AsApp *app, const gchar *category)
 {
-       GDir *dir;
+       GPtrArray *categories;
        const gchar *tmp;
-       gboolean ret = TRUE;
+       guint i;
 
-       /* simply test if the first item is a file and if not, the icons are
-        * in the new /var/cache/app-info/icons/${repo}/gimp.png layout */
-       dir = g_dir_open (dirname, 0, NULL);
-       if (dir == NULL)
-               goto out;
-       tmp = g_dir_read_name (dir);
-       ret = g_strstr_len (tmp, -1, ".") == NULL;
-out:
-       if (dir != NULL)
-               g_dir_close (dir);
-       return ret;
+       categories = as_app_get_categories (app);
+       for (i = 0; i < categories->len; i++) {
+               tmp = g_ptr_array_index (categories, i);
+               if (g_strcmp0 (tmp, category) == 0)
+                       return TRUE;
+       }
+       return FALSE;
+}
+
+/**
+ * as_app_has_compulsory_for_desktop:
+ */
+static gboolean
+as_app_has_compulsory_for_desktop (AsApp *app, const gchar *compulsory_for_desktop)
+{
+       GPtrArray *compulsory_for_desktops;
+       const gchar *tmp;
+       guint i;
+
+       compulsory_for_desktops = as_app_get_compulsory_for_desktops (app);
+       for (i = 0; i < compulsory_for_desktops->len; i++) {
+               tmp = g_ptr_array_index (compulsory_for_desktops, i);
+               if (g_strcmp0 (tmp, compulsory_for_desktop) == 0)
+                       return TRUE;
+       }
+       return FALSE;
 }
 
 /**
@@ -78,23 +91,22 @@ static gboolean
 gs_plugin_parse_xml_file (GsPlugin *plugin,
                          const gchar *parent_dir,
                          const gchar *filename,
-                         const gchar *path_icons,
+                         const gchar *icon_root,
                          GCancellable *cancellable,
                          GError **error)
 {
        GError *error_local = NULL;
        GFile *file = NULL;
        gboolean ret = FALSE;
-       gchar *path_icons_full = NULL;
        gchar *path_xml = NULL;
-       gchar *repo_id;
+       gchar *origin_fallback;
        gchar *tmp;
 
        /* the first component of the file (e.g. "fedora-20.xml.gz)
         * is used for the icon directory as we might want to clean up
         * the icons manually if they are installed in /var/cache */
-       repo_id = g_strdup (filename);
-       tmp = g_strstr_len (repo_id, -1, ".xml");
+       origin_fallback = g_strdup (filename);
+       tmp = g_strstr_len (origin_fallback, -1, ".xml");
        if (tmp == NULL) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
@@ -106,30 +118,21 @@ gs_plugin_parse_xml_file (GsPlugin *plugin,
        }
        tmp[0] = '\0';
 
-       /* support both old and new layouts */
-       if (gs_plugin_appstream_icons_are_new_layout (path_icons)) {
-               path_icons_full = g_build_filename (path_icons,
-                                                   repo_id,
-                                                   NULL);
-       } else {
-               path_icons_full = g_strdup (path_icons);
-       }
-
        /* load this specific file */
        path_xml  = g_build_filename (parent_dir, filename, NULL);
        g_debug ("Loading AppStream XML %s with icon path %s",
-                path_xml,
-                path_icons_full);
+                path_xml, icon_root);
        file = g_file_new_for_path (path_xml);
-       ret = appstream_cache_parse_file (plugin->priv->cache,
-                                         file,
-                                         path_icons_full,
-                                         NULL,
-                                         &error_local);
+       as_store_set_origin (plugin->priv->store, origin_fallback);
+       ret = as_store_from_file (plugin->priv->store,
+                                 file,
+                                 icon_root,
+                                 cancellable,
+                                 &error_local);
        if (!ret) {
                if (g_error_matches (error_local,
-                                    APPSTREAM_CACHE_ERROR,
-                                    APPSTREAM_CACHE_ERROR_FAILED)) {
+                                    AS_NODE_ERROR,
+                                    AS_NODE_ERROR_FAILED)) {
                        ret = TRUE;
                        g_warning ("AppStream XML invalid: %s", error_local->message);
                        g_error_free (error_local);
@@ -139,9 +142,8 @@ gs_plugin_parse_xml_file (GsPlugin *plugin,
                goto out;
        }
 out:
-       g_free (path_icons_full);
        g_free (path_xml);
-       g_free (repo_id);
+       g_free (origin_fallback);
        if (file != NULL)
                g_object_unref (file);
        return ret;
@@ -169,7 +171,7 @@ gs_plugin_appstream_cache_changed_cb (GFileMonitor *monitor,
 static gboolean
 gs_plugin_parse_xml_dir (GsPlugin *plugin,
                         const gchar *path_xml,
-                        const gchar *path_icons,
+                        const gchar *icon_root,
                         GCancellable *cancellable,
                         GError **error)
 {
@@ -204,7 +206,7 @@ gs_plugin_parse_xml_dir (GsPlugin *plugin,
                ret = gs_plugin_parse_xml_file (plugin,
                                                path_xml,
                                                tmp,
-                                               path_icons,
+                                               icon_root,
                                                cancellable,
                                                error);
                if (!ret)
@@ -229,44 +231,44 @@ gs_plugin_parse_xml (GsPlugin *plugin, GCancellable *cancellable, GError **error
        const gchar * const * data_dirs;
        gboolean ret;
        gchar *path_xml = NULL;
-       gchar *path_icons = NULL;
+       gchar *icon_root = NULL;
        guint i;
 
        /* search all files */
        data_dirs = g_get_system_data_dirs ();
        for (i = 0; data_dirs[i] != NULL; i++) {
                path_xml = g_build_filename (data_dirs[i], "app-info", "xmls", NULL);
-               path_icons = g_build_filename (data_dirs[i], "app-info", "icons", NULL);
+               icon_root = g_build_filename (data_dirs[i], "app-info", "icons", NULL);
                ret = gs_plugin_parse_xml_dir (plugin,
                                               path_xml,
-                                              path_icons,
+                                              icon_root,
                                               cancellable,
                                               error);
                g_free (path_xml);
-               g_free (path_icons);
+               g_free (icon_root);
                if (!ret)
                        goto out;
        }
        path_xml = g_build_filename (g_get_user_data_dir (), "app-info", "xmls", NULL);
-       path_icons = g_build_filename (g_get_user_data_dir (), "app-info", "icons", NULL);
+       icon_root = g_build_filename (g_get_user_data_dir (), "app-info", "icons", NULL);
        ret = gs_plugin_parse_xml_dir (plugin,
                                       path_xml,
-                                      path_icons,
+                                      icon_root,
                                       cancellable,
                                       error);
        g_free (path_xml);
-       g_free (path_icons);
+       g_free (icon_root);
        if (!ret)
                goto out;
        path_xml = g_build_filename (LOCALSTATEDIR, "cache", "app-info", "xmls", NULL);
-       path_icons = g_build_filename (LOCALSTATEDIR, "cache", "app-info", "icons", NULL);
+       icon_root = g_build_filename (LOCALSTATEDIR, "cache", "app-info", "icons", NULL);
        ret = gs_plugin_parse_xml_dir (plugin,
                                       path_xml,
-                                      path_icons,
+                                      icon_root,
                                       cancellable,
                                       error);
        g_free (path_xml);
-       g_free (path_icons);
+       g_free (icon_root);
        if (!ret)
                goto out;
 out:
@@ -281,7 +283,7 @@ gs_plugin_initialize (GsPlugin *plugin)
 {
        plugin->priv = GS_PLUGIN_GET_PRIVATE (GsPluginPrivate);
        plugin->priv->file_monitors = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
-       plugin->priv->cache = appstream_cache_new ();
+       plugin->priv->store = as_store_new ();
        plugin->priv->cachedir = g_build_filename (DATADIR,
                                                   "app-info",
                                                   "icons",
@@ -308,7 +310,7 @@ gs_plugin_destroy (GsPlugin *plugin)
 {
        g_free (plugin->priv->cachedir);
        g_free (plugin->priv->locale);
-       g_object_unref (plugin->priv->cache);
+       g_object_unref (plugin->priv->store);
        g_ptr_array_unref (plugin->priv->file_monitors);
 }
 
@@ -318,7 +320,7 @@ gs_plugin_destroy (GsPlugin *plugin)
 static gboolean
 gs_plugin_startup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
 {
-       AppstreamApp *app;
+       AsApp *app;
        GPtrArray *items;
        gboolean ret;
        gchar *tmp;
@@ -338,7 +340,7 @@ gs_plugin_startup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
        ret = gs_plugin_parse_xml (plugin, cancellable, error);
        if (!ret)
                goto out;
-       items = appstream_cache_get_items (plugin->priv->cache);
+       items = as_store_get_apps (plugin->priv->store);
        if (items->len == 0) {
                g_warning ("No AppStream data, try 'make install-sample-data' in data/");
                ret = FALSE;
@@ -352,12 +354,12 @@ gs_plugin_startup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
        /* add icons to the icon name cache */
        for (i = 0; i < items->len; i++) {
                app = g_ptr_array_index (items, i);
-               if (appstream_app_get_icon_kind (app) != APPSTREAM_APP_ICON_KIND_CACHED)
+               if (as_app_get_icon_kind (app) != AS_ICON_KIND_CACHED)
                        continue;
                g_hash_table_insert (plugin->icon_cache,
-                                    g_strdup (appstream_app_get_id (app)),
-                                    g_build_filename (appstream_app_get_userdata (app),
-                                                      appstream_app_get_icon (app),
+                                    g_strdup (as_app_get_id (app)),
+                                    g_build_filename (as_app_get_icon_path (app),
+                                                      as_app_get_icon (app),
                                                       NULL));
        }
 out:
@@ -406,7 +408,7 @@ out:
  * gs_plugin_refine_item_pixbuf:
  */
 static void
-gs_plugin_refine_item_pixbuf (GsPlugin *plugin, GsApp *app, AppstreamApp *item)
+gs_plugin_refine_item_pixbuf (GsPlugin *plugin, GsApp *app, AsApp *item)
 {
        GError *error = NULL;
        const gchar *icon;
@@ -414,12 +416,12 @@ gs_plugin_refine_item_pixbuf (GsPlugin *plugin, GsApp *app, AppstreamApp *item)
        gboolean ret;
        gchar *icon_path = NULL;
 
-       icon = appstream_app_get_icon (item);
-       switch (appstream_app_get_icon_kind (item)) {
-       case APPSTREAM_APP_ICON_KIND_REMOTE:
+       icon = as_app_get_icon (item);
+       switch (as_app_get_icon_kind (item)) {
+       case AS_ICON_KIND_REMOTE:
                gs_app_set_icon (app, icon);
                break;
-       case APPSTREAM_APP_ICON_KIND_STOCK:
+       case AS_ICON_KIND_STOCK:
                gs_app_set_icon (app, icon);
                ret = gs_app_load_icon (app, &error);
                if (!ret) {
@@ -429,10 +431,10 @@ gs_plugin_refine_item_pixbuf (GsPlugin *plugin, GsApp *app, AppstreamApp *item)
                        goto out;
                }
                break;
-       case APPSTREAM_APP_ICON_KIND_CACHED:
+       case AS_ICON_KIND_CACHED:
 
                /* we assume <icon type="local">gnome-chess.png</icon> */
-               icon_dir = appstream_app_get_userdata (item);
+               icon_dir = as_app_get_icon_path (item);
                icon_path = g_build_filename (icon_dir, icon, NULL);
                gs_app_set_icon (app, icon_path);
                ret = gs_app_load_icon (app, &error);
@@ -469,11 +471,11 @@ out:
  * gs_plugin_refine_add_screenshots:
  */
 static void
-gs_plugin_refine_add_screenshots (GsApp *app, AppstreamApp *item)
+gs_plugin_refine_add_screenshots (GsApp *app, AsApp *item)
 {
-       AppstreamImage *im;
-       AppstreamScreenshot *ss;
-       AppstreamScreenshotKind ss_kind;
+       AsImage *im;
+       AsScreenshot *ss;
+       AsScreenshotKind ss_kind;
        GPtrArray *images_as;
        GPtrArray *screenshots_as;
        GsScreenshot *screenshot;
@@ -481,7 +483,7 @@ gs_plugin_refine_add_screenshots (GsApp *app, AppstreamApp *item)
        guint j;
 
        /* do we have any to add */
-       screenshots_as = appstream_app_get_screenshots (item);
+       screenshots_as = as_app_get_screenshots (item);
        if (screenshots_as->len == 0)
                return;
 
@@ -494,25 +496,25 @@ gs_plugin_refine_add_screenshots (GsApp *app, AppstreamApp *item)
        for (i = 0; i < screenshots_as->len &&
                    i < GS_PLUGIN_APPSTREAM_MAX_SCREENSHOTS; i++) {
                ss = g_ptr_array_index (screenshots_as, i);
-               images_as = appstream_screenshot_get_images (ss);
+               images_as = as_screenshot_get_images (ss);
                if (images_as->len == 0)
                        continue;
-               ss_kind = appstream_screenshot_get_kind (ss);
-               if (ss_kind == APPSTREAM_SCREENSHOT_KIND_UNKNOWN)
+               ss_kind = as_screenshot_get_kind (ss);
+               if (ss_kind == AS_SCREENSHOT_KIND_UNKNOWN)
                        continue;
 
                /* create a new application screenshot and add each image */
                screenshot = gs_screenshot_new ();
                gs_screenshot_set_is_default (screenshot,
-                                             ss_kind == APPSTREAM_SCREENSHOT_KIND_DEFAULT);
+                                             ss_kind == AS_SCREENSHOT_KIND_DEFAULT);
                gs_screenshot_set_caption (screenshot,
-                                          appstream_screenshot_get_caption (ss));
+                                          as_screenshot_get_caption (ss, NULL));
                for (j = 0; j < images_as->len; j++) {
                        im = g_ptr_array_index (images_as, j);
                        gs_screenshot_add_image (screenshot,
-                                                appstream_image_get_url (im),
-                                                appstream_image_get_width (im),
-                                                appstream_image_get_height (im));
+                                                as_image_get_url (im),
+                                                as_image_get_width (im),
+                                                as_image_get_height (im));
                }
                gs_app_add_screenshot (app, screenshot);
                g_object_unref (screenshot);
@@ -525,17 +527,19 @@ gs_plugin_refine_add_screenshots (GsApp *app, AppstreamApp *item)
 static gboolean
 gs_plugin_refine_item (GsPlugin *plugin,
                       GsApp *app,
-                      AppstreamApp *item,
+                      AsApp *item,
                       GError **error)
 {
        GHashTable *urls;
-       GPtrArray *tmp;
+       GPtrArray *pkgnames;
+       const gchar *tmp;
        gboolean ret = TRUE;
+       gchar *from_xml;
 
        /* is an app */
        if (gs_app_get_kind (app) == GS_APP_KIND_UNKNOWN ||
            gs_app_get_kind (app) == GS_APP_KIND_PACKAGE) {
-               if (appstream_app_get_id_kind (item) == APPSTREAM_APP_ID_KIND_SOURCE) {
+               if (as_app_get_id_kind (item) == AS_ID_KIND_SOURCE) {
                        gs_app_set_kind (app, GS_APP_KIND_SOURCE);
                } else {
                        gs_app_set_kind (app, GS_APP_KIND_NORMAL);
@@ -543,25 +547,27 @@ gs_plugin_refine_item (GsPlugin *plugin,
        }
 
        /* set id */
-       if (appstream_app_get_id (item) != NULL && gs_app_get_id (app) == NULL)
-               gs_app_set_id (app, appstream_app_get_id (item));
+       if (as_app_get_id (item) != NULL && gs_app_get_id (app) == NULL)
+               gs_app_set_id (app, as_app_get_id (item));
 
        /* set name */
-       if (appstream_app_get_name (item) != NULL) {
+       tmp = as_app_get_name (item, NULL);
+       if (tmp != NULL) {
                gs_app_set_name (app,
                                 GS_APP_QUALITY_HIGHEST,
-                                appstream_app_get_name (item));
+                                as_app_get_name (item, NULL));
        }
 
        /* set summary */
-       if (appstream_app_get_summary (item) != NULL) {
+       tmp = as_app_get_comment (item, NULL);
+       if (tmp != NULL) {
                gs_app_set_summary (app,
                                    GS_APP_QUALITY_HIGHEST,
-                                   appstream_app_get_summary (item));
+                                   as_app_get_comment (item, NULL));
        }
 
        /* add urls */
-       urls = appstream_app_get_urls (item);
+       urls = as_app_get_urls (item);
        if (g_hash_table_size (urls) > 0 &&
            gs_app_get_url (app, GS_APP_URL_KIND_HOMEPAGE) == NULL) {
                GList *keys;
@@ -576,70 +582,77 @@ gs_plugin_refine_item (GsPlugin *plugin,
        }
 
        /* set licence */
-       if (appstream_app_get_project_license (item) != NULL && gs_app_get_licence (app) == NULL)
-               gs_app_set_licence (app, appstream_app_get_project_license (item));
+       if (as_app_get_project_license (item) != NULL && gs_app_get_licence (app) == NULL)
+               gs_app_set_licence (app, as_app_get_project_license (item));
 
        /* set keywords */
-       if (appstream_app_get_keywords (item) != NULL &&
+       if (as_app_get_keywords (item) != NULL &&
            gs_app_get_keywords (app) == NULL) {
-               gs_app_set_keywords (app, appstream_app_get_keywords (item));
+               gs_app_set_keywords (app, as_app_get_keywords (item));
                gs_app_add_kudo (app, GS_APP_KUDO_HAS_KEYWORDS);
        }
 
        /* set description */
-       if (appstream_app_get_description (item) != NULL) {
+       tmp = as_app_get_description (item, NULL);
+       if (tmp != NULL) {
+               from_xml = as_markup_convert_simple (tmp, -1, error);
+               if (from_xml == NULL) {
+                       ret = FALSE;
+                       goto out;
+               }
                gs_app_set_description (app,
                                        GS_APP_QUALITY_HIGHEST,
-                                       appstream_app_get_description (item));
+                                       from_xml);
+               g_free (from_xml);
        }
 
        /* set icon */
-       if (appstream_app_get_icon (item) != NULL && gs_app_get_pixbuf (app) == NULL)
+       if (as_app_get_icon (item) != NULL && gs_app_get_pixbuf (app) == NULL)
                gs_plugin_refine_item_pixbuf (plugin, app, item);
 
        /* set categories */
-       if (appstream_app_get_categories (item) != NULL &&
+       if (as_app_get_categories (item) != NULL &&
            gs_app_get_categories (app)->len == 0)
-               gs_app_set_categories (app, appstream_app_get_categories (item));
+               gs_app_set_categories (app, as_app_get_categories (item));
 
        /* set project group */
-       if (appstream_app_get_project_group (item) != NULL &&
+       if (as_app_get_project_group (item) != NULL &&
            gs_app_get_project_group (app) == NULL)
-               gs_app_set_project_group (app, appstream_app_get_project_group (item));
+               gs_app_set_project_group (app, as_app_get_project_group (item));
 
        /* this is a core application for the desktop and cannot be removed */
-       if (appstream_app_get_desktop_core (item, "GNOME") &&
+       if (as_app_has_compulsory_for_desktop (item, "GNOME") &&
            gs_app_get_kind (app) == GS_APP_KIND_NORMAL)
                gs_app_set_kind (app, GS_APP_KIND_SYSTEM);
 
        /* set id kind */
        if (gs_app_get_id_kind (app) == GS_APP_ID_KIND_UNKNOWN)
-               gs_app_set_id_kind (app, appstream_app_get_id_kind (item));
+               gs_app_set_id_kind (app, as_app_get_id_kind (item));
 
        /* set package names */
-       tmp = appstream_app_get_pkgnames (item);
-       if (tmp->len > 0 && gs_app_get_sources(app)->len == 0)
-               gs_app_set_sources (app, tmp);
+       pkgnames = as_app_get_pkgnames (item);
+       if (pkgnames->len > 0 && gs_app_get_sources(app)->len == 0)
+               gs_app_set_sources (app, pkgnames);
 
        /* set screenshots */
        gs_plugin_refine_add_screenshots (app, item);
 
        /* add kudos */
-       if (appstream_app_has_locale (item, plugin->priv->locale) > 50)
+       if (as_app_get_language (item, plugin->priv->locale) > 50)
                gs_app_add_kudo (app, GS_APP_KUDO_MY_LANGUAGE);
-       if (appstream_app_get_metadata_item (item, "X-Kudo-GTK3") != NULL)
+       if (as_app_get_metadata_item (item, "X-Kudo-GTK3") != NULL)
                gs_app_add_kudo (app, GS_APP_KUDO_MODERN_TOOLKIT);
-       if (appstream_app_get_metadata_item (item, "X-Kudo-SearchProvider") != NULL)
+       if (as_app_get_metadata_item (item, "X-Kudo-SearchProvider") != NULL)
                gs_app_add_kudo (app, GS_APP_KUDO_SEARCH_PROVIDER);
-       if (appstream_app_get_metadata_item (item, "X-Kudo-InstallsUserDocs") != NULL)
+       if (as_app_get_metadata_item (item, "X-Kudo-InstallsUserDocs") != NULL)
                gs_app_add_kudo (app, GS_APP_KUDO_INSTALLS_USER_DOCS);
-       if (appstream_app_get_metadata_item (item, "X-Kudo-UsesNotifications") != NULL)
+       if (as_app_get_metadata_item (item, "X-Kudo-UsesNotifications") != NULL)
                gs_app_add_kudo (app, GS_APP_KUDO_USES_NOTIFICATIONS);
-       if (appstream_app_get_metadata_item (item, "X-Kudo-RecentRelease") != NULL)
+       if (as_app_get_metadata_item (item, "X-Kudo-RecentRelease") != NULL)
                gs_app_add_kudo (app, GS_APP_KUDO_RECENT_RELEASE);
-       if (appstream_app_get_metadata_item (item, "X-Kudo-UsesAppMenu") != NULL)
+       if (as_app_get_metadata_item (item, "X-Kudo-UsesAppMenu") != NULL)
                gs_app_add_kudo (app, GS_APP_KUDO_USES_APP_MENU);
-
+out:
        return ret;
 }
 
@@ -653,13 +666,13 @@ gs_plugin_refine_from_id (GsPlugin *plugin,
 {
        const gchar *id;
        gboolean ret = TRUE;
-       AppstreamApp *item;
+       AsApp *item;
 
        /* find anything that matches the ID */
        id = gs_app_get_id_full (app);
        if (id == NULL)
                goto out;
-       item = appstream_cache_get_item_by_id (plugin->priv->cache, id);
+       item = as_store_get_app_by_id (plugin->priv->store, id);
        if (item == NULL)
                goto out;
 
@@ -679,7 +692,7 @@ gs_plugin_refine_from_pkgname (GsPlugin *plugin,
                               GsApp *app,
                               GError **error)
 {
-       AppstreamApp *item = NULL;
+       AsApp *item = NULL;
        GPtrArray *sources;
        const gchar *pkgname;
        gboolean ret = TRUE;
@@ -689,8 +702,8 @@ gs_plugin_refine_from_pkgname (GsPlugin *plugin,
        sources = gs_app_get_sources (app);
        for (i = 0; i < sources->len && item == NULL; i++) {
                pkgname = g_ptr_array_index (sources, i);
-               item = appstream_cache_get_item_by_pkgname (plugin->priv->cache,
-                                                           pkgname);
+               item = as_store_get_app_by_pkgname (plugin->priv->store,
+                                                   pkgname);
                if (item == NULL)
                        g_debug ("no AppStream match for {pkgname} %s", pkgname);
        }
@@ -765,7 +778,7 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
        const gchar *search_id2 = NULL;
        gboolean ret = TRUE;
        GsApp *app;
-       AppstreamApp *item;
+       AsApp *item;
        GsCategory *parent;
        GPtrArray *array;
        guint i;
@@ -792,18 +805,18 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
        }
 
        /* just look at each app in turn */
-       array = appstream_cache_get_items (plugin->priv->cache);
+       array = as_store_get_apps (plugin->priv->store);
        for (i = 0; i < array->len; i++) {
                item = g_ptr_array_index (array, i);
-               if (appstream_app_get_id (item) == NULL)
+               if (as_app_get_id (item) == NULL)
                        continue;
-               if (!appstream_app_has_category (item, search_id1))
+               if (!as_app_has_category (item, search_id1))
                        continue;
-               if (search_id2 != NULL && !appstream_app_has_category (item, search_id2))
+               if (search_id2 != NULL && !as_app_has_category (item, search_id2))
                        continue;
 
                /* got a search match, so add all the data we can */
-               app = gs_app_new (appstream_app_get_id (item));
+               app = gs_app_new (as_app_get_id (item));
                ret = gs_plugin_refine_item (plugin, app, item, error);
                if (!ret)
                        goto out;
@@ -818,14 +831,14 @@ out:
  * gs_plugin_appstream_match_item:
  */
 static gboolean
-gs_plugin_appstream_match_item (AppstreamApp *item, gchar **values)
+gs_plugin_appstream_match_item (AsApp *item, gchar **values)
 {
        guint matches = 0;
        guint i;
 
        /* does the GsApp match *all* search keywords */
        for (i = 0; values[i] != NULL; i++) {
-               matches = appstream_app_search_matches (item, values[i]);
+               matches = as_app_search_matches (item, values[i]);
                if (matches == 0)
                        break;
        }
@@ -842,7 +855,7 @@ gs_plugin_add_search (GsPlugin *plugin,
                      GCancellable *cancellable,
                      GError **error)
 {
-       AppstreamApp *item;
+       AsApp *item;
        gboolean ret = TRUE;
        GPtrArray *array;
        GsApp *app;
@@ -858,11 +871,11 @@ gs_plugin_add_search (GsPlugin *plugin,
 
        /* search categories for the search term */
        gs_profile_start (plugin->profile, "appstream::search");
-       array = appstream_cache_get_items (plugin->priv->cache);
+       array = as_store_get_apps (plugin->priv->store);
        for (i = 0; i < array->len; i++) {
                item = g_ptr_array_index (array, i);
                if (gs_plugin_appstream_match_item (item, values)) {
-                       app = gs_app_new (appstream_app_get_id (item));
+                       app = gs_app_new (as_app_get_id (item));
                        ret = gs_plugin_refine_item (plugin, app, item, error);
                        if (!ret)
                                goto out;
@@ -883,7 +896,7 @@ gs_plugin_add_categories (GsPlugin *plugin,
                          GCancellable *cancellable,
                          GError **error)
 {
-       AppstreamApp *item;
+       AsApp *item;
        const gchar *search_id1;
        const gchar *search_id2 = NULL;
        gboolean ret = TRUE;
@@ -903,9 +916,9 @@ gs_plugin_add_categories (GsPlugin *plugin,
                        goto out;
        }
 
-       /* find out how many packages are in each category */
+       /* find ogs_plugin_as_store_changed_cbut how many packages are in each category */
        gs_profile_start (plugin->profile, "appstream::add-categories");
-       array = appstream_cache_get_items (plugin->priv->cache);
+       array = as_store_get_apps (plugin->priv->store);
        for (l = *list; l != NULL; l = l->next) {
                parent = GS_CATEGORY (l->data);
                search_id2 = gs_category_get_id (parent);
@@ -916,15 +929,15 @@ gs_plugin_add_categories (GsPlugin *plugin,
                        /* just look at each app in turn */
                        for (i = 0; i < array->len; i++) {
                                item = g_ptr_array_index (array, i);
-                               if (appstream_app_get_id (item) == NULL)
+                               if (as_app_get_id (item) == NULL)
                                        continue;
-                               if (appstream_app_get_priority (item) < 0)
+                               if (as_app_get_priority (item) < 0)
                                        continue;
-                               if (!appstream_app_has_category (item, search_id2))
+                               if (!as_app_has_category (item, search_id2))
                                        continue;
                                search_id1 = gs_category_get_id (category);
                                if (search_id1 != NULL &&
-                                   !appstream_app_has_category (item, search_id1))
+                                   !as_app_has_category (item, search_id1))
                                        continue;
 
                                /* we have another result */
diff --git a/src/plugins/gs-self-test.c b/src/plugins/gs-self-test.c
index f8bbb69..46b76ba 100644
--- a/src/plugins/gs-self-test.c
+++ b/src/plugins/gs-self-test.c
@@ -26,121 +26,9 @@
 #include <glib-object.h>
 #include <gtk/gtk.h>
 
-#include "appstream-common.h"
-#include "appstream-markup.h"
-
 #include "gs-moduleset.h"
 
 static void
-appstream_common_func (void)
-{
-       gchar *tmp;
-
-       g_assert_cmpstr (appstream_tag_to_string (APPSTREAM_TAG_PROJECT_LICENSE), == ,"project_license");
-       g_assert_cmpint (appstream_tag_from_string ("licence"), == ,APPSTREAM_TAG_PROJECT_LICENSE);
-       g_assert_cmpint (appstream_get_locale_value ("C"), ==, G_MAXUINT - 1);
-       g_assert_cmpint (appstream_get_locale_value ("xxx"), ==, G_MAXUINT);
-
-       /* test unmunging white-space */
-       tmp = appstream_xml_unmunge ("  This is a sample.\n\nData was collected.  ", -1);
-       g_assert_cmpstr (tmp, ==, "This is a sample. Data was collected.");
-       g_free (tmp);
-
-       /* test unmunging escape chars */
-       tmp = appstream_xml_unmunge ("Bar &amp; &#34;Nob&#34; &gt; &#39;eBay&#39;", -1);
-       g_assert_cmpstr (tmp, ==, "Bar & \"Nob\" > 'eBay'");
-       g_free (tmp);
-}
-
-static void
-appstream_markup_plain_func (void)
-{
-       AppstreamMarkup *markup;
-       const gchar *tmp;
-
-       markup = appstream_markup_new ();
-       appstream_markup_set_enabled (markup, TRUE);
-       appstream_markup_set_lang (markup, NULL);
-
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_START);
-       appstream_markup_add_content (markup, "This is preformatted\n\nOne", -1);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_END);
-
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_START);
-       appstream_markup_set_lang (markup, "xx_XX");
-       appstream_markup_add_content (markup, "This is dave\n\nOne", -1);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_END);
-
-       tmp = appstream_markup_get_text (markup);
-       g_assert_cmpstr (tmp, ==, "This is preformatted\n\nOne");
-
-       appstream_markup_free (markup);
-}
-
-static void
-appstream_markup_tags_func (void)
-{
-       AppstreamMarkup *markup;
-       const gchar *tmp;
-
-       markup = appstream_markup_new ();
-       appstream_markup_set_enabled (markup, TRUE);
-       appstream_markup_set_lang (markup, NULL);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_START);
-       appstream_markup_add_content (markup, "    ", -1);
-
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_P_START);
-       appstream_markup_add_content (markup, "Para1", -1);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_P_END);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_UL_START);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_LI_START);
-       appstream_markup_add_content (markup, "Item1", -1);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_LI_END);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_LI_START);
-       appstream_markup_add_content (markup, "Item2", -1);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_LI_END);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_UL_END);
-
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_END);
-       tmp = appstream_markup_get_text (markup);
-       g_assert_cmpstr (tmp, ==, "Para1\n • Item1\n • Item2");
-
-       appstream_markup_free (markup);
-}
-
-static void
-appstream_markup_locale_func (void)
-{
-       AppstreamMarkup *markup;
-       const gchar *tmp;
-
-       markup = appstream_markup_new ();
-       appstream_markup_set_enabled (markup, TRUE);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_START);
-
-       appstream_markup_set_lang (markup, "XXX");
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_P_START);
-       appstream_markup_add_content (markup, "Para:XXX", -1);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_P_END);
-
-       appstream_markup_set_lang (markup, NULL);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_P_START);
-       appstream_markup_add_content (markup, "Para:C", -1);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_P_END);
-
-       appstream_markup_set_lang (markup, "YYY");
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_P_START);
-       appstream_markup_add_content (markup, "Para:YYY", -1);
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_P_END);
-
-       appstream_markup_set_mode (markup, APPSTREAM_MARKUP_MODE_END);
-       tmp = appstream_markup_get_text (markup);
-       g_assert_cmpstr (tmp, ==, "Para:C");
-
-       appstream_markup_free (markup);
-}
-
-static void
 moduleset_func (void)
 {
        gboolean ret;
@@ -188,10 +76,6 @@ main (int argc, char **argv)
 
        /* tests go here */
        g_test_add_func ("/moduleset", moduleset_func);
-       g_test_add_func ("/appstream-common", appstream_common_func);
-       g_test_add_func ("/appstream-markup{plain}", appstream_markup_plain_func);
-       g_test_add_func ("/appstream-markup{tags}", appstream_markup_tags_func);
-       g_test_add_func ("/appstream-markup{locale}", appstream_markup_locale_func);
 
        return g_test_run ();
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]