summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2017-04-15 12:18:18 +0100
committerRichard Hughes <richard@hughsie.com>2017-04-15 12:18:18 +0100
commit24024e9f9645957cf9839c684aa37414ea0528dc (patch)
tree9eb9fdd9e197f3e692c42637c2a66bbfa82bbef9
parentb7fe571792213e379270170794308993093405ab (diff)
downloadappstream-glib-24024e9f9645957cf9839c684aa37414ea0528dc.tar.gz
Allow using the app origin as a search keyword
-rw-r--r--client/as-util.c1
-rw-r--r--libappstream-glib/as-app.c6
-rw-r--r--libappstream-glib/as-app.h2
3 files changed, 9 insertions, 0 deletions
diff --git a/client/as-util.c b/client/as-util.c
index aef892f..20ddb7b 100644
--- a/client/as-util.c
+++ b/client/as-util.c
@@ -1307,6 +1307,7 @@ as_util_search (AsUtilPrivate *priv, gchar **values, GError **error)
AS_APP_SEARCH_MATCH_COMMENT |
AS_APP_SEARCH_MATCH_NAME |
AS_APP_SEARCH_MATCH_KEYWORD |
+ AS_APP_SEARCH_MATCH_ORIGIN |
AS_APP_SEARCH_MATCH_ID);
as_store_load_search_cache (store);
diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c
index edd7419..67e0673 100644
--- a/libappstream-glib/as-app.c
+++ b/libappstream-glib/as-app.c
@@ -5545,6 +5545,12 @@ as_app_create_token_cache_target (AsApp *app, AsApp *donor)
as_app_add_token (app, tmp, FALSE, AS_APP_SEARCH_MATCH_PKGNAME);
}
}
+ if (priv->search_match & AS_APP_SEARCH_MATCH_ORIGIN) {
+ if (priv->origin != NULL) {
+ as_app_add_token (app, priv->origin, TRUE,
+ AS_APP_SEARCH_MATCH_ORIGIN);
+ }
+ }
}
static void
diff --git a/libappstream-glib/as-app.h b/libappstream-glib/as-app.h
index 2f734c7..b66bc14 100644
--- a/libappstream-glib/as-app.h
+++ b/libappstream-glib/as-app.h
@@ -442,6 +442,7 @@ typedef enum {
* @AS_APP_SEARCH_MATCH_NAME: Use the app name
* @AS_APP_SEARCH_MATCH_KEYWORD: Use the app keyword
* @AS_APP_SEARCH_MATCH_ID: Use the app application ID
+ * @AS_APP_SEARCH_MATCH_ORIGIN: Use the app origin
*
* The token match kind, which we want to be exactly 16 bits for storage
* reasons.
@@ -455,6 +456,7 @@ typedef enum __attribute__((__packed__)) {
AS_APP_SEARCH_MATCH_NAME = 1 << 4, /* Since: 0.6.5 */
AS_APP_SEARCH_MATCH_KEYWORD = 1 << 5, /* Since: 0.6.5 */
AS_APP_SEARCH_MATCH_ID = 1 << 6, /* Since: 0.6.5 */
+ AS_APP_SEARCH_MATCH_ORIGIN = 1 << 7, /* Since: 0.6.13 */
/*< private >*/
AS_APP_SEARCH_MATCH_LAST = 0xffff
} AsAppSearchMatch;