summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-03-23 10:47:38 +0000
committerRichard Hughes <richard@hughsie.com>2016-03-23 10:47:38 +0000
commitab2bb1d8316c90a661d3e9ad18d8574e3f126d64 (patch)
tree5f9cf9a94cf5a4271f6aca8a6100b9046e7c46f5
parentad75a92566903ccff22c59342752b6a5632a7e07 (diff)
downloadappstream-glib-ab2bb1d8316c90a661d3e9ad18d8574e3f126d64.tar.gz
Add as_app_get_id_no_prefix()
-rw-r--r--libappstream-glib/as-app.c23
-rw-r--r--libappstream-glib/as-app.h1
2 files changed, 24 insertions, 0 deletions
diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c
index ded1a55..6ea424f 100644
--- a/libappstream-glib/as-app.c
+++ b/libappstream-glib/as-app.c
@@ -462,6 +462,29 @@ as_app_get_id (AsApp *app)
}
/**
+ * as_app_get_id_no_prefix:
+ * @app: a #AsApp instance.
+ *
+ * Gets the full ID value, stripping any prefix.
+ *
+ * Returns: the ID, e.g. "org.gnome.Software.desktop"
+ *
+ * Since: 0.5.12
+ **/
+const gchar *
+as_app_get_id_no_prefix (AsApp *app)
+{
+ AsAppPrivate *priv = GET_PRIVATE (app);
+ gchar *tmp;
+ if (priv->id == NULL)
+ return NULL;
+ tmp = g_strrstr (priv->id, ":");
+ if (tmp != NULL)
+ return tmp + 1;
+ return priv->id;
+}
+
+/**
* as_app_get_id_filename:
* @app: a #AsApp instance.
*
diff --git a/libappstream-glib/as-app.h b/libappstream-glib/as-app.h
index b71cec8..6b1d603 100644
--- a/libappstream-glib/as-app.h
+++ b/libappstream-glib/as-app.h
@@ -303,6 +303,7 @@ GPtrArray *as_app_get_vetos (AsApp *app);
const gchar *as_app_get_icon_path (AsApp *app);
const gchar *as_app_get_id_filename (AsApp *app);
const gchar *as_app_get_id (AsApp *app);
+const gchar *as_app_get_id_no_prefix (AsApp *app);
const gchar *as_app_get_pkgname_default (AsApp *app);
const gchar *as_app_get_source_pkgname (AsApp *app);
const gchar *as_app_get_origin (AsApp *app);