1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2  *
3  * Copyright (C) 2014-2018 Richard Hughes <richard@hughsie.com>
4  *
5  * SPDX-License-Identifier: LGPL-2.1+
6  */
7 
8 #pragma once
9 
10 #if !defined (__APPSTREAM_GLIB_H_INSIDE__) && !defined (AS_COMPILATION)
11 #error "Only <appstream-glib.h> can be included directly."
12 #endif
13 
14 #include <glib-object.h>
15 
16 #include "as-bundle.h"
17 #include "as-enums.h"
18 #include "as-format.h"
19 #include "as-icon.h"
20 #include "as-launchable.h"
21 #include "as-provide.h"
22 #include "as-release.h"
23 #include "as-screenshot.h"
24 #include "as-require.h"
25 #include "as-review.h"
26 #include "as-suggest.h"
27 #include "as-content-rating.h"
28 #include "as-agreement.h"
29 #include "as-translation.h"
30 
31 G_BEGIN_DECLS
32 
33 #define AS_TYPE_APP (as_app_get_type ())
34 G_DECLARE_DERIVABLE_TYPE (AsApp, as_app, AS, APP, GObject)
35 
36 struct _AsAppClass
37 {
38 	GObjectClass		parent_class;
39 	/*< private >*/
40 	void (*_as_reserved1)	(void);
41 	void (*_as_reserved2)	(void);
42 	void (*_as_reserved3)	(void);
43 	void (*_as_reserved4)	(void);
44 	void (*_as_reserved5)	(void);
45 	void (*_as_reserved6)	(void);
46 	void (*_as_reserved7)	(void);
47 	void (*_as_reserved8)	(void);
48 };
49 
50 /**
51  * AsAppParseFlags:
52  * @AS_APP_PARSE_FLAG_NONE:		No special actions to use
53  * @AS_APP_PARSE_FLAG_USE_HEURISTICS:	Use heuristic to infer properties
54  * @AS_APP_PARSE_FLAG_KEEP_COMMENTS:	Save comments from the file
55  * @AS_APP_PARSE_FLAG_CONVERT_TRANSLATABLE:	Allow translatable flags like <_p>
56  * @AS_APP_PARSE_FLAG_APPEND_DATA:	Append new data rather than replacing
57  * @AS_APP_PARSE_FLAG_ALLOW_VETO:	Do not return errors for vetoed apps
58  * @AS_APP_PARSE_FLAG_USE_FALLBACKS:	Fall back to suboptimal data where required
59  * @AS_APP_PARSE_FLAG_ADD_ALL_METADATA:	Add all extra metadata from the source file
60  * @AS_APP_PARSE_FLAG_ONLY_NATIVE_LANGS:	Only load native languages
61  *
62  * The flags to use when parsing resources.
63  **/
64 typedef enum {
65 	AS_APP_PARSE_FLAG_NONE			= 0,
66 	AS_APP_PARSE_FLAG_USE_HEURISTICS	= 1 << 0,	/* Since: 0.1.2 */
67 	AS_APP_PARSE_FLAG_KEEP_COMMENTS		= 1 << 1,	/* Since: 0.1.6 */
68 	AS_APP_PARSE_FLAG_CONVERT_TRANSLATABLE	= 1 << 2,	/* Since: 0.1.6 */
69 	AS_APP_PARSE_FLAG_APPEND_DATA		= 1 << 3,	/* Since: 0.1.8 */
70 	AS_APP_PARSE_FLAG_ALLOW_VETO		= 1 << 4,	/* Since: 0.2.5 */
71 	AS_APP_PARSE_FLAG_USE_FALLBACKS		= 1 << 5,	/* Since: 0.4.1 */
72 	AS_APP_PARSE_FLAG_ADD_ALL_METADATA	= 1 << 6,	/* Since: 0.6.1 */
73 	AS_APP_PARSE_FLAG_ONLY_NATIVE_LANGS	= 1 << 7,	/* Since: 0.6.3 */
74 	/*< private >*/
75 	AS_APP_PARSE_FLAG_LAST,
76 } AsAppParseFlags;
77 
78 /**
79  * AsAppSubsumeFlags:
80  * @AS_APP_SUBSUME_FLAG_NONE:		No special actions to use
81  * @AS_APP_SUBSUME_FLAG_NO_OVERWRITE:	Do not overwrite already set properties
82  * @AS_APP_SUBSUME_FLAG_BOTH_WAYS:	Copy unset properties both ways
83  * @AS_APP_SUBSUME_FLAG_PARTIAL:	Only subsume a safe subset (obsolete)
84  * @AS_APP_SUBSUME_FLAG_KIND:		Copy the kind
85  * @AS_APP_SUBSUME_FLAG_STATE:		Copy the state
86  * @AS_APP_SUBSUME_FLAG_BUNDLES:	Copy the bundles
87  * @AS_APP_SUBSUME_FLAG_TRANSLATIONS:	Copy the translations
88  * @AS_APP_SUBSUME_FLAG_RELEASES:	Copy the releases
89  * @AS_APP_SUBSUME_FLAG_KUDOS:		Copy the kudos
90  * @AS_APP_SUBSUME_FLAG_CATEGORIES:	Copy the categories
91  * @AS_APP_SUBSUME_FLAG_PERMISSIONS:	Copy the permissions
92  * @AS_APP_SUBSUME_FLAG_EXTENDS:	Copy the extends
93  * @AS_APP_SUBSUME_FLAG_COMPULSORY:	Copy the compulsory-for-desktop
94  * @AS_APP_SUBSUME_FLAG_SCREENSHOTS:	Copy the screenshots
95  * @AS_APP_SUBSUME_FLAG_REVIEWS:	Copy the reviews
96  * @AS_APP_SUBSUME_FLAG_CONTENT_RATINGS: Copy the content ratings
97  * @AS_APP_SUBSUME_FLAG_AGREEMENTS:	Copy the agreements
98  * @AS_APP_SUBSUME_FLAG_PROVIDES:	Copy the provides
99  * @AS_APP_SUBSUME_FLAG_ICONS:		Copy the icons
100  * @AS_APP_SUBSUME_FLAG_MIMETYPES:	Copy the mimetypes
101  * @AS_APP_SUBSUME_FLAG_VETOS:		Copy the vetos
102  * @AS_APP_SUBSUME_FLAG_LANGUAGES:	Copy the languages
103  * @AS_APP_SUBSUME_FLAG_NAME:		Copy the name
104  * @AS_APP_SUBSUME_FLAG_COMMENT:	Copy the comment
105  * @AS_APP_SUBSUME_FLAG_DEVELOPER_NAME:	Copy the developer name
106  * @AS_APP_SUBSUME_FLAG_DESCRIPTION:	Copy the description
107  * @AS_APP_SUBSUME_FLAG_METADATA:	Copy the metadata
108  * @AS_APP_SUBSUME_FLAG_URL:		Copy the urls
109  * @AS_APP_SUBSUME_FLAG_KEYWORDS:	Copy the keywords
110  * @AS_APP_SUBSUME_FLAG_FORMATS:	Copy the source file
111  * @AS_APP_SUBSUME_FLAG_BRANCH:		Copy the branch
112  * @AS_APP_SUBSUME_FLAG_ORIGIN:		Copy the origin
113  * @AS_APP_SUBSUME_FLAG_METADATA_LICENSE: Copy the metadata license
114  * @AS_APP_SUBSUME_FLAG_PROJECT_LICENSE: Copy the project license
115  * @AS_APP_SUBSUME_FLAG_PROJECT_GROUP:	Copy the project group
116  * @AS_APP_SUBSUME_FLAG_SOURCE_KIND:	Copy the source kind
117  * @AS_APP_SUBSUME_FLAG_LAUNCHABLES:	Copy the launchables
118  *
119  * The flags to use when subsuming applications.
120  **/
121 typedef enum {
122 	AS_APP_SUBSUME_FLAG_NONE		= 0,
123 	AS_APP_SUBSUME_FLAG_NO_OVERWRITE	= 1ull << 0,	/* Since: 0.1.4 */
124 	AS_APP_SUBSUME_FLAG_BOTH_WAYS		= 1ull << 1,	/* Since: 0.1.4 */
125 	AS_APP_SUBSUME_FLAG_REPLACE		= 1ull << 2,	/* Since: 0.6.3 */
126 	AS_APP_SUBSUME_FLAG_KIND		= 1ull << 3,	/* Since: 0.6.1 */
127 	AS_APP_SUBSUME_FLAG_STATE		= 1ull << 4,	/* Since: 0.6.1 */
128 	AS_APP_SUBSUME_FLAG_BUNDLES		= 1ull << 5,	/* Since: 0.6.1 */
129 	AS_APP_SUBSUME_FLAG_TRANSLATIONS	= 1ull << 6,	/* Since: 0.6.1 */
130 	AS_APP_SUBSUME_FLAG_RELEASES		= 1ull << 7,	/* Since: 0.6.1 */
131 	AS_APP_SUBSUME_FLAG_KUDOS		= 1ull << 8,	/* Since: 0.6.1 */
132 	AS_APP_SUBSUME_FLAG_CATEGORIES		= 1ull << 9,	/* Since: 0.6.1 */
133 	AS_APP_SUBSUME_FLAG_PERMISSIONS		= 1ull << 10,	/* Since: 0.6.1 */
134 	AS_APP_SUBSUME_FLAG_EXTENDS		= 1ull << 11,	/* Since: 0.6.1 */
135 	AS_APP_SUBSUME_FLAG_COMPULSORY		= 1ull << 12,	/* Since: 0.6.1 */
136 	AS_APP_SUBSUME_FLAG_SCREENSHOTS		= 1ull << 13,	/* Since: 0.6.1 */
137 	AS_APP_SUBSUME_FLAG_REVIEWS		= 1ull << 14,	/* Since: 0.6.1 */
138 	AS_APP_SUBSUME_FLAG_CONTENT_RATINGS	= 1ull << 15,	/* Since: 0.6.1 */
139 	AS_APP_SUBSUME_FLAG_PROVIDES		= 1ull << 16,	/* Since: 0.6.1 */
140 	AS_APP_SUBSUME_FLAG_ICONS		= 1ull << 17,	/* Since: 0.6.1 */
141 	AS_APP_SUBSUME_FLAG_MIMETYPES		= 1ull << 18,	/* Since: 0.6.1 */
142 	AS_APP_SUBSUME_FLAG_VETOS		= 1ull << 19,	/* Since: 0.6.1 */
143 	AS_APP_SUBSUME_FLAG_LANGUAGES		= 1ull << 20,	/* Since: 0.6.1 */
144 	AS_APP_SUBSUME_FLAG_NAME		= 1ull << 21,	/* Since: 0.6.1 */
145 	AS_APP_SUBSUME_FLAG_COMMENT		= 1ull << 22,	/* Since: 0.6.1 */
146 	AS_APP_SUBSUME_FLAG_DEVELOPER_NAME	= 1ull << 23,	/* Since: 0.6.1 */
147 	AS_APP_SUBSUME_FLAG_DESCRIPTION		= 1ull << 24,	/* Since: 0.6.1 */
148 	AS_APP_SUBSUME_FLAG_METADATA		= 1ull << 25,	/* Since: 0.6.1 */
149 	AS_APP_SUBSUME_FLAG_URL			= 1ull << 26,	/* Since: 0.6.1 */
150 	AS_APP_SUBSUME_FLAG_KEYWORDS		= 1ull << 27,	/* Since: 0.6.1 */
151 	AS_APP_SUBSUME_FLAG_FORMATS		= 1ull << 28,	/* Since: 0.6.1 */
152 	AS_APP_SUBSUME_FLAG_BRANCH		= 1ull << 29,	/* Since: 0.6.1 */
153 	AS_APP_SUBSUME_FLAG_ORIGIN		= 1ull << 30,	/* Since: 0.6.1 */
154 	AS_APP_SUBSUME_FLAG_METADATA_LICENSE	= 1ull << 31,	/* Since: 0.6.1 */
155 	AS_APP_SUBSUME_FLAG_PROJECT_LICENSE	= 1ull << 32,	/* Since: 0.6.1 */
156 	AS_APP_SUBSUME_FLAG_PROJECT_GROUP	= 1ull << 33,	/* Since: 0.6.1 */
157 	AS_APP_SUBSUME_FLAG_SOURCE_KIND		= 1ull << 34,	/* Since: 0.6.1 */
158 	AS_APP_SUBSUME_FLAG_SUGGESTS		= 1ull << 35,	/* Since: 0.6.3 */
159 	AS_APP_SUBSUME_FLAG_LAUNCHABLES		= 1ull << 36,	/* Since: 0.6.13 */
160 	AS_APP_SUBSUME_FLAG_AGREEMENTS		= 1ull << 37,	/* Since: 0.7.8 */
161 	/*< private >*/
162 	AS_APP_SUBSUME_FLAG_LAST,
163 } AsAppSubsumeFlags;
164 
165 /* deprecated */
166 #define AS_APP_SUBSUME_FLAG_SOURCE_FILE		AS_APP_SUBSUME_FLAG_FORMATS
167 
168 /* safe to do from a merge <component> */
169 #define AS_APP_SUBSUME_FLAG_MERGE	(AS_APP_SUBSUME_FLAG_CATEGORIES | \
170 					 AS_APP_SUBSUME_FLAG_COMMENT | \
171 					 AS_APP_SUBSUME_FLAG_COMPULSORY | \
172 					 AS_APP_SUBSUME_FLAG_CONTENT_RATINGS | \
173 					 AS_APP_SUBSUME_FLAG_AGREEMENTS | \
174 					 AS_APP_SUBSUME_FLAG_DESCRIPTION | \
175 					 AS_APP_SUBSUME_FLAG_DEVELOPER_NAME | \
176 					 AS_APP_SUBSUME_FLAG_EXTENDS | \
177 					 AS_APP_SUBSUME_FLAG_ICONS | \
178 					 AS_APP_SUBSUME_FLAG_KEYWORDS | \
179 					 AS_APP_SUBSUME_FLAG_KUDOS | \
180 					 AS_APP_SUBSUME_FLAG_LANGUAGES | \
181 					 AS_APP_SUBSUME_FLAG_MIMETYPES | \
182 					 AS_APP_SUBSUME_FLAG_METADATA | \
183 					 AS_APP_SUBSUME_FLAG_NAME | \
184 					 AS_APP_SUBSUME_FLAG_PERMISSIONS | \
185 					 AS_APP_SUBSUME_FLAG_PROJECT_GROUP | \
186 					 AS_APP_SUBSUME_FLAG_PROVIDES | \
187 					 AS_APP_SUBSUME_FLAG_RELEASES | \
188 					 AS_APP_SUBSUME_FLAG_REVIEWS | \
189 					 AS_APP_SUBSUME_FLAG_SCREENSHOTS | \
190 					 AS_APP_SUBSUME_FLAG_SUGGESTS | \
191 					 AS_APP_SUBSUME_FLAG_TRANSLATIONS | \
192 					 AS_APP_SUBSUME_FLAG_SOURCE_KIND | \
193 					 AS_APP_SUBSUME_FLAG_LAUNCHABLES | \
194 					 AS_APP_SUBSUME_FLAG_URL)
195 
196 /* deprecated name */
197 #define AS_APP_SUBSUME_FLAG_PARTIAL	AS_APP_SUBSUME_FLAG_MERGE
198 
199 /* all properties */
200 #define AS_APP_SUBSUME_FLAG_DEDUPE	(AS_APP_SUBSUME_FLAG_BRANCH | \
201 					 AS_APP_SUBSUME_FLAG_BUNDLES | \
202 					 AS_APP_SUBSUME_FLAG_KIND | \
203 					 AS_APP_SUBSUME_FLAG_MERGE | \
204 					 AS_APP_SUBSUME_FLAG_METADATA | \
205 					 AS_APP_SUBSUME_FLAG_ORIGIN | \
206 					 AS_APP_SUBSUME_FLAG_PROJECT_LICENSE | \
207 					 AS_APP_SUBSUME_FLAG_FORMATS | \
208 					 AS_APP_SUBSUME_FLAG_STATE | \
209 					 AS_APP_SUBSUME_FLAG_VETOS)
210 
211 /**
212  * AsAppError:
213  * @AS_APP_ERROR_FAILED:			Generic failure
214  * @AS_APP_ERROR_INVALID_TYPE:			Invalid type
215  *
216  * The error type.
217  **/
218 typedef enum {
219 	AS_APP_ERROR_FAILED,
220 	AS_APP_ERROR_INVALID_TYPE,
221 	/*< private >*/
222 	AS_APP_ERROR_LAST
223 } AsAppError;
224 
225 /**
226  * AsAppValidateFlags:
227  * @AS_APP_VALIDATE_FLAG_NONE:			No extra flags to use
228  * @AS_APP_VALIDATE_FLAG_RELAX:			Relax the checks
229  * @AS_APP_VALIDATE_FLAG_STRICT:		Make the checks more strict
230  * @AS_APP_VALIDATE_FLAG_NO_NETWORK:		Do not use the network
231  * @AS_APP_VALIDATE_FLAG_ALL_APPS:		Check all applications in a store
232  *
233  * The flags to use when validating.
234  **/
235 typedef enum {
236 	AS_APP_VALIDATE_FLAG_NONE		= 0,	/* Since: 0.1.4 */
237 	AS_APP_VALIDATE_FLAG_RELAX		= 1,	/* Since: 0.1.4 */
238 	AS_APP_VALIDATE_FLAG_STRICT		= 2,	/* Since: 0.1.4 */
239 	AS_APP_VALIDATE_FLAG_NO_NETWORK		= 4,	/* Since: 0.1.4 */
240 	AS_APP_VALIDATE_FLAG_ALL_APPS		= 8,	/* Since: 0.2.6 */
241 	/*< private >*/
242 	AS_APP_VALIDATE_FLAG_LAST
243 } AsAppValidateFlags;
244 
245 /**
246  * AsAppTrustFlags:
247  * @AS_APP_TRUST_FLAG_COMPLETE:			Trusted data with no validation
248  * @AS_APP_TRUST_FLAG_CHECK_DUPLICATES:		Check for duplicates
249  * @AS_APP_TRUST_FLAG_CHECK_VALID_UTF8:		Check for valid UTF-8
250  *
251  * The flags to use when checking input.
252  **/
253 typedef enum {
254 	AS_APP_TRUST_FLAG_COMPLETE		= 0,	/* Since: 0.2.2 */
255 	AS_APP_TRUST_FLAG_CHECK_DUPLICATES	= 1,	/* Since: 0.2.2 */
256 	AS_APP_TRUST_FLAG_CHECK_VALID_UTF8	= 2,	/* Since: 0.2.2 */
257 	/*< private >*/
258 	AS_APP_TRUST_FLAG_LAST
259 } AsAppTrustFlags;
260 
261 /**
262  * AsAppSourceKind:
263  * @AS_APP_SOURCE_KIND_UNKNOWN:			Not sourced from a file
264  * @AS_APP_SOURCE_KIND_APPSTREAM:		Sourced from a AppStream file
265  * @AS_APP_SOURCE_KIND_DESKTOP:			Sourced from a desktop file
266  * @AS_APP_SOURCE_KIND_APPDATA:			Sourced from a AppData file
267  * @AS_APP_SOURCE_KIND_METAINFO:		Sourced from a MetaInfo file
268  * @AS_APP_SOURCE_KIND_INF:			Sourced from a inf file
269  *
270  * The source kind.
271  *
272  * This has been deprecated since 0.6.9 in favour of using AsFormatKind.
273  **/
274 typedef AsFormatKind AsAppSourceKind;
275 #define	AS_APP_SOURCE_KIND_UNKNOWN	AS_FORMAT_KIND_UNKNOWN		/* Since: 0.1.4 */
276 #define	AS_APP_SOURCE_KIND_APPSTREAM	AS_FORMAT_KIND_APPSTREAM	/* Since: 0.1.4 */
277 #define	AS_APP_SOURCE_KIND_DESKTOP	AS_FORMAT_KIND_DESKTOP		/* Since: 0.1.4 */
278 #define	AS_APP_SOURCE_KIND_APPDATA	AS_FORMAT_KIND_APPDATA		/* Since: 0.1.4 */
279 #define	AS_APP_SOURCE_KIND_METAINFO	AS_FORMAT_KIND_METAINFO		/* Since: 0.1.7 */
280 #define	AS_APP_SOURCE_KIND_INF		AS_FORMAT_KIND_UNKNOWN		/* Since: 0.3.5 */
281 
282 /**
283  * AsAppKind:
284  * @AS_APP_KIND_UNKNOWN:		Type invalid or not known
285  * @AS_APP_KIND_DESKTOP:		A desktop application
286  * @AS_APP_KIND_FONT:			A font add-on
287  * @AS_APP_KIND_CODEC:			A codec add-on
288  * @AS_APP_KIND_INPUT_METHOD:		A input method add-on
289  * @AS_APP_KIND_WEB_APP:		A web appication
290  * @AS_APP_KIND_SOURCE:			A software source
291  * @AS_APP_KIND_ADDON:			An addon, e.g. a plugin
292  * @AS_APP_KIND_FIRMWARE:		A firmware update
293  * @AS_APP_KIND_RUNTIME:		Runtime platform
294  * @AS_APP_KIND_GENERIC:		Generic component
295  * @AS_APP_KIND_OS_UPDATE:		Operating system update
296  * @AS_APP_KIND_OS_UPGRADE:		Operating system upgrade
297  * @AS_APP_KIND_SHELL_EXTENSION:	GNOME Shell extension
298  * @AS_APP_KIND_LOCALIZATION:		Localization data
299  * @AS_APP_KIND_CONSOLE:		Console program
300  * @AS_APP_KIND_DRIVER:			Driver for hardware support
301  * @AS_APP_KIND_ICON_THEME:		An icon theme
302  *
303  * The component type.
304  **/
305 typedef enum {
306 	AS_APP_KIND_UNKNOWN,		/* Since: 0.5.10 */
307 	AS_APP_KIND_DESKTOP,		/* Since: 0.5.10 */
308 	AS_APP_KIND_FONT,		/* Since: 0.5.10 */
309 	AS_APP_KIND_CODEC,		/* Since: 0.5.10 */
310 	AS_APP_KIND_INPUT_METHOD,	/* Since: 0.5.10 */
311 	AS_APP_KIND_WEB_APP,		/* Since: 0.5.10 */
312 	AS_APP_KIND_SOURCE,		/* Since: 0.5.10 */
313 	AS_APP_KIND_ADDON,		/* Since: 0.5.10 */
314 	AS_APP_KIND_FIRMWARE,		/* Since: 0.5.10 */
315 	AS_APP_KIND_RUNTIME,		/* Since: 0.5.10 */
316 	AS_APP_KIND_GENERIC,		/* Since: 0.5.10 */
317 	AS_APP_KIND_OS_UPDATE,		/* Since: 0.5.10 */
318 	AS_APP_KIND_OS_UPGRADE,		/* Since: 0.5.10 */
319 	AS_APP_KIND_SHELL_EXTENSION,	/* Since: 0.5.10 */
320 	AS_APP_KIND_LOCALIZATION,	/* Since: 0.5.11 */
321 	AS_APP_KIND_CONSOLE,		/* Since: 0.6.1 */
322 	AS_APP_KIND_DRIVER,		/* Since: 0.6.3 */
323 	AS_APP_KIND_ICON_THEME,		/* Since: 0.7.17 */
324 	/*< private >*/
325 	AS_APP_KIND_LAST
326 } AsAppKind;
327 
328 /**
329  * AsAppQuirk:
330  * @AS_APP_QUIRK_NONE:			No special attributes
331  * @AS_APP_QUIRK_PROVENANCE:		Installed by OS vendor
332  * @AS_APP_QUIRK_COMPULSORY:		Cannot be removed
333  * @AS_APP_QUIRK_HAS_SOURCE:		Has a source to allow staying up-to-date
334  * @AS_APP_QUIRK_MATCH_ANY_PREFIX:	Matches applications with any prefix
335  * @AS_APP_QUIRK_NEEDS_REBOOT:		A reboot is required after the action
336  * @AS_APP_QUIRK_NOT_REVIEWABLE:	The app is not reviewable
337  * @AS_APP_QUIRK_HAS_SHORTCUT:		The app has a shortcut in the system
338  * @AS_APP_QUIRK_NOT_LAUNCHABLE:	The app is not launchable (run-able)
339  * @AS_APP_QUIRK_NEEDS_USER_ACTION:	The component requires some kind of user action
340  * @AS_APP_QUIRK_IS_PROXY:		Is a proxy app that operates on other applications
341  * @AS_APP_QUIRK_REMOVABLE_HARDWARE:	The device is unusable whilst the action is performed
342  * @AS_APP_QUIRK_DEVELOPER_VERIFIED:	The app developer has been verified
343  *
344  * The component attributes.
345  **/
346 typedef enum {
347 	AS_APP_QUIRK_NONE		= 0,		/* Since: 0.5.10 */
348 	AS_APP_QUIRK_PROVENANCE		= 1 << 0,	/* Since: 0.5.10 */
349 	AS_APP_QUIRK_COMPULSORY		= 1 << 1,	/* Since: 0.5.10 */
350 	AS_APP_QUIRK_HAS_SOURCE		= 1 << 2,	/* Since: 0.5.10 */
351 	AS_APP_QUIRK_MATCH_ANY_PREFIX	= 1 << 3,	/* Since: 0.5.12 */
352 	AS_APP_QUIRK_NEEDS_REBOOT	= 1 << 4,	/* Since: 0.5.14 */
353 	AS_APP_QUIRK_NOT_REVIEWABLE	= 1 << 5,	/* Since: 0.5.14 */
354 	AS_APP_QUIRK_HAS_SHORTCUT	= 1 << 6,	/* Since: 0.5.15 */
355 	AS_APP_QUIRK_NOT_LAUNCHABLE	= 1 << 7,	/* Since: 0.5.15 */
356 	AS_APP_QUIRK_NEEDS_USER_ACTION	= 1 << 8,	/* Since: 0.6.2 */
357 	AS_APP_QUIRK_IS_PROXY 		= 1 << 9,	/* Since: 0.6.6 */
358 	AS_APP_QUIRK_REMOVABLE_HARDWARE	= 1 << 10,	/* Since: 0.6.6 */
359 	AS_APP_QUIRK_DEVELOPER_VERIFIED	= 1 << 11,	/* Since: 0.7.11 */
360 	/*< private >*/
361 	AS_APP_QUIRK_LAST
362 } AsAppQuirk;
363 
364 /**
365  * AsAppState:
366  * @AS_APP_STATE_UNKNOWN:			Unknown state
367  * @AS_APP_STATE_INSTALLED:			Application is installed
368  * @AS_APP_STATE_AVAILABLE:			Application is available
369  * @AS_APP_STATE_AVAILABLE_LOCAL:		Application is locally available as a file
370  * @AS_APP_STATE_UPDATABLE:			Application is installed and updatable
371  * @AS_APP_STATE_UNAVAILABLE:			Application is referenced, but not available
372  * @AS_APP_STATE_QUEUED_FOR_INSTALL:		Application is queued for install
373  * @AS_APP_STATE_INSTALLING:			Application is being installed
374  * @AS_APP_STATE_REMOVING:			Application is being removed
375  * @AS_APP_STATE_UPDATABLE_LIVE:		Application is installed and updatable live
376  * @AS_APP_STATE_PURCHASABLE:			Application is available for purchasing
377  * @AS_APP_STATE_PURCHASING:			Application is being purchased
378  *
379  * The application state.
380  **/
381 typedef enum {
382 	AS_APP_STATE_UNKNOWN,				/* Since: 0.2.2 */
383 	AS_APP_STATE_INSTALLED,				/* Since: 0.2.2 */
384 	AS_APP_STATE_AVAILABLE,				/* Since: 0.2.2 */
385 	AS_APP_STATE_AVAILABLE_LOCAL,			/* Since: 0.2.2 */
386 	AS_APP_STATE_UPDATABLE,				/* Since: 0.2.2 */
387 	AS_APP_STATE_UNAVAILABLE,			/* Since: 0.2.2 */
388 	AS_APP_STATE_QUEUED_FOR_INSTALL,		/* Since: 0.2.2 */
389 	AS_APP_STATE_INSTALLING,			/* Since: 0.2.2 */
390 	AS_APP_STATE_REMOVING,				/* Since: 0.2.2 */
391 	AS_APP_STATE_UPDATABLE_LIVE,			/* Since: 0.5.4 */
392 	AS_APP_STATE_PURCHASABLE,			/* Since: 0.5.17 */
393 	AS_APP_STATE_PURCHASING,			/* Since: 0.5.17 */
394 	/*< private >*/
395 	AS_APP_STATE_LAST
396 } AsAppState;
397 
398 /**
399  * AsAppScope:
400  * @AS_APP_SCOPE_UNKNOWN:			Unknown scope
401  * @AS_APP_SCOPE_USER:				User scope
402  * @AS_APP_SCOPE_SYSTEM:			System scope
403  *
404  * The application scope.
405  **/
406 typedef enum {
407 	AS_APP_SCOPE_UNKNOWN,				/* Since: 0.6.1 */
408 	AS_APP_SCOPE_USER,				/* Since: 0.6.1 */
409 	AS_APP_SCOPE_SYSTEM,				/* Since: 0.6.1 */
410 	/*< private >*/
411 	AS_APP_SCOPE_LAST
412 } AsAppScope;
413 
414 /**
415  * AsAppMergeKind:
416  * @AS_APP_MERGE_KIND_UNKNOWN:			Unknown merge type
417  * @AS_APP_MERGE_KIND_NONE:			No merge to be done
418  * @AS_APP_MERGE_KIND_REPLACE:			Merge components, replacing
419  * @AS_APP_MERGE_KIND_APPEND:			Merge components, appending
420  *
421  * The component merge kind.
422  **/
423 typedef enum {
424 	AS_APP_MERGE_KIND_UNKNOWN,			/* Since: 0.6.1 */
425 	AS_APP_MERGE_KIND_NONE,				/* Since: 0.6.1 */
426 	AS_APP_MERGE_KIND_REPLACE,			/* Since: 0.6.1 */
427 	AS_APP_MERGE_KIND_APPEND,			/* Since: 0.6.1 */
428 	/*< private >*/
429 	AS_APP_MERGE_KIND_LAST
430 } AsAppMergeKind;
431 
432 /**
433  * AsAppSearchMatch:
434  * @AS_APP_SEARCH_MATCH_NONE:			No token matching
435  * @AS_APP_SEARCH_MATCH_MIMETYPE:		Use the app mimetypes
436  * @AS_APP_SEARCH_MATCH_PKGNAME:		Use the app package name
437  * @AS_APP_SEARCH_MATCH_DESCRIPTION:		Use the app description
438  * @AS_APP_SEARCH_MATCH_COMMENT:		Use the app comment
439  * @AS_APP_SEARCH_MATCH_NAME:			Use the app name
440  * @AS_APP_SEARCH_MATCH_KEYWORD:		Use the app keyword
441  * @AS_APP_SEARCH_MATCH_ID:			Use the app application ID
442  * @AS_APP_SEARCH_MATCH_ORIGIN:			Use the app origin
443  *
444  * The token match kind, which we want to be exactly 16 bits for storage
445  * reasons.
446  **/
447 typedef enum __attribute__((__packed__)) {
448 	AS_APP_SEARCH_MATCH_NONE	= 0,		/* Since: 0.6.5 */
449 	AS_APP_SEARCH_MATCH_MIMETYPE	= 1 << 0,	/* Since: 0.6.5 */
450 	AS_APP_SEARCH_MATCH_PKGNAME	= 1 << 1,	/* Since: 0.6.5 */
451 	AS_APP_SEARCH_MATCH_DESCRIPTION	= 1 << 2,	/* Since: 0.6.5 */
452 	AS_APP_SEARCH_MATCH_COMMENT	= 1 << 3,	/* Since: 0.6.5 */
453 	AS_APP_SEARCH_MATCH_NAME	= 1 << 4,	/* Since: 0.6.5 */
454 	AS_APP_SEARCH_MATCH_KEYWORD	= 1 << 5,	/* Since: 0.6.5 */
455 	AS_APP_SEARCH_MATCH_ID		= 1 << 6,	/* Since: 0.6.5 */
456 	AS_APP_SEARCH_MATCH_ORIGIN	= 1 << 7,	/* Since: 0.6.13 */
457 	/*< private >*/
458 	AS_APP_SEARCH_MATCH_LAST	= 0xffff
459 } AsAppSearchMatch;
460 
461 #define	AS_APP_ERROR				as_app_error_quark ()
462 
463 AsApp		*as_app_new			(void);
464 GQuark		 as_app_error_quark		(void);
465 const gchar	*as_app_state_to_string		(AsAppState	 state);
466 const gchar	*as_app_kind_to_string		(AsAppKind	 kind);
467 AsAppKind	 as_app_kind_from_string	(const gchar	*kind);
468 AsAppScope	 as_app_scope_from_string	(const gchar	*scope);
469 const gchar	*as_app_scope_to_string		(AsAppScope	 scope);
470 AsAppMergeKind	 as_app_merge_kind_from_string	(const gchar	*merge_kind);
471 const gchar	*as_app_merge_kind_to_string	(AsAppMergeKind	 merge_kind);
472 
473 /* getters */
474 AsAppKind	 as_app_get_kind		(AsApp		*app);
475 AsAppScope	 as_app_get_scope		(AsApp		*app);
476 AsAppMergeKind	 as_app_get_merge_kind		(AsApp		*app);
477 AsAppState	 as_app_get_state		(AsApp		*app);
478 guint32		 as_app_get_trust_flags		(AsApp		*app);
479 guint16		 as_app_get_search_match	(AsApp		*app);
480 GList		*as_app_get_languages		(AsApp		*app);
481 GPtrArray	*as_app_get_addons		(AsApp		*app);
482 GPtrArray	*as_app_get_categories		(AsApp		*app);
483 GPtrArray	*as_app_get_compulsory_for_desktops (AsApp	*app);
484 GPtrArray	*as_app_get_extends		(AsApp		*app);
485 GPtrArray	*as_app_get_keywords		(AsApp		*app,
486 						 const gchar	*locale);
487 GPtrArray	*as_app_get_kudos		(AsApp		*app);
488 GPtrArray	*as_app_get_permissions		(AsApp		*app);
489 GPtrArray	*as_app_get_formats		(AsApp		*app);
490 GPtrArray	*as_app_get_mimetypes		(AsApp		*app);
491 GPtrArray	*as_app_get_pkgnames		(AsApp		*app);
492 GPtrArray	*as_app_get_architectures	(AsApp		*app);
493 GPtrArray	*as_app_get_releases		(AsApp		*app);
494 GPtrArray	*as_app_get_provides		(AsApp		*app);
495 GPtrArray	*as_app_get_launchables		(AsApp		*app);
496 GPtrArray	*as_app_get_screenshots		(AsApp		*app);
497 GPtrArray	*as_app_get_reviews		(AsApp		*app);
498 GPtrArray	*as_app_get_content_ratings	(AsApp		*app);
499 GPtrArray	*as_app_get_icons		(AsApp		*app);
500 GPtrArray	*as_app_get_bundles		(AsApp		*app);
501 GPtrArray	*as_app_get_translations	(AsApp		*app);
502 GPtrArray	*as_app_get_suggests		(AsApp		*app);
503 GPtrArray	*as_app_get_requires		(AsApp		*app);
504 GHashTable	*as_app_get_names		(AsApp		*app);
505 GHashTable	*as_app_get_comments		(AsApp		*app);
506 GHashTable	*as_app_get_developer_names	(AsApp		*app);
507 GHashTable	*as_app_get_metadata		(AsApp		*app);
508 GHashTable	*as_app_get_descriptions	(AsApp		*app);
509 GHashTable	*as_app_get_urls		(AsApp		*app);
510 GPtrArray	*as_app_get_vetos		(AsApp		*app);
511 const gchar	*as_app_get_icon_path		(AsApp		*app);
512 const gchar	*as_app_get_id_filename		(AsApp		*app);
513 const gchar	*as_app_get_id			(AsApp		*app);
514 const gchar	*as_app_get_id_no_prefix	(AsApp		*app);
515 const gchar	*as_app_get_unique_id		(AsApp		*app);
516 const gchar	*as_app_get_pkgname_default	(AsApp		*app);
517 const gchar	*as_app_get_source_pkgname	(AsApp		*app);
518 const gchar	*as_app_get_origin		(AsApp		*app);
519 const gchar	*as_app_get_project_group	(AsApp		*app);
520 const gchar	*as_app_get_project_license	(AsApp		*app);
521 const gchar	*as_app_get_metadata_license	(AsApp		*app);
522 const gchar	*as_app_get_update_contact	(AsApp		*app);
523 const gchar	*as_app_get_branch		(AsApp		*app);
524 const gchar	*as_app_get_name		(AsApp		*app,
525 						 const gchar	*locale);
526 const gchar	*as_app_get_comment		(AsApp		*app,
527 						 const gchar	*locale);
528 const gchar	*as_app_get_developer_name	(AsApp		*app,
529 						 const gchar	*locale);
530 const gchar	*as_app_get_description		(AsApp		*app,
531 						 const gchar	*locale);
532 gint		 as_app_get_priority		(AsApp		*app);
533 gint		 as_app_get_language		(AsApp		*app,
534 						 const gchar	*locale);
535 const gchar	*as_app_get_metadata_item	(AsApp		*app,
536 						 const gchar	*key);
537 const gchar	*as_app_get_url_item		(AsApp		*app,
538 						 AsUrlKind	 url_kind);
539 gboolean	 as_app_has_category		(AsApp		*app,
540 						 const gchar	*category);
541 gboolean	 as_app_has_kudo		(AsApp		*app,
542 						 const gchar	*kudo);
543 gboolean	 as_app_has_kudo_kind		(AsApp		*app,
544 						 AsKudoKind	 kudo);
545 gboolean	 as_app_has_permission		(AsApp		*app,
546 						 const gchar	*permission);
547 AsFormat	*as_app_get_format_default	(AsApp		*app);
548 AsFormat	*as_app_get_format_by_kind	(AsApp		*app,
549 						 AsFormatKind	 kind);
550 AsFormat	*as_app_get_format_by_filename	(AsApp		*app,
551 						 const gchar	*filename);
552 gboolean	 as_app_has_compulsory_for_desktop (AsApp	*app,
553 						 const gchar	*desktop);
554 gboolean	 as_app_has_quirk		(AsApp		*app,
555 						 AsAppQuirk	 quirk);
556 AsLaunchable	*as_app_get_launchable_default	(AsApp		*app);
557 AsLaunchable	*as_app_get_launchable_by_kind	(AsApp		*app,
558 						 AsLaunchableKind kind);
559 
560 /* setters */
561 void		 as_app_set_id			(AsApp		*app,
562 						 const gchar	*id);
563 void		 as_app_set_kind		(AsApp		*app,
564 						 AsAppKind	 kind);
565 void		 as_app_set_scope		(AsApp		*app,
566 						 AsAppScope	 scope);
567 void		 as_app_set_merge_kind		(AsApp		*app,
568 						 AsAppMergeKind	 merge_kind);
569 void		 as_app_set_state		(AsApp		*app,
570 						 AsAppState	 state);
571 void		 as_app_set_trust_flags		(AsApp		*app,
572 						 guint32	 trust_flags);
573 void		 as_app_set_search_match	(AsApp		*app,
574 						 guint16	 search_match);
575 void		 as_app_set_origin		(AsApp		*app,
576 						 const gchar	*origin);
577 void		 as_app_set_project_group	(AsApp		*app,
578 						 const gchar	*project_group);
579 void		 as_app_set_project_license	(AsApp		*app,
580 						 const gchar	*project_license);
581 void		 as_app_set_metadata_license	(AsApp		*app,
582 						 const gchar	*metadata_license);
583 void		 as_app_set_source_pkgname	(AsApp		*app,
584 						 const gchar	*source_pkgname);
585 void		 as_app_set_update_contact	(AsApp		*app,
586 						 const gchar	*update_contact);
587 void		 as_app_set_icon_path		(AsApp		*app,
588 						 const gchar	*icon_path);
589 void		 as_app_set_name		(AsApp		*app,
590 						 const gchar	*locale,
591 						 const gchar	*name);
592 void		 as_app_set_comment		(AsApp		*app,
593 						 const gchar	*locale,
594 						 const gchar	*comment);
595 void		 as_app_set_developer_name	(AsApp		*app,
596 						 const gchar	*locale,
597 						 const gchar	*developer_name);
598 void		 as_app_set_description		(AsApp		*app,
599 						 const gchar	*locale,
600 						 const gchar	*description);
601 void		 as_app_set_branch		(AsApp		*app,
602 						 const gchar	*branch);
603 void		 as_app_set_priority		(AsApp		*app,
604 						 gint		 priority);
605 void		 as_app_add_category		(AsApp		*app,
606 						 const gchar	*category);
607 void		 as_app_remove_category		(AsApp		*app,
608 						 const gchar	*category);
609 void		 as_app_add_keyword		(AsApp		*app,
610 						 const gchar	*locale,
611 						 const gchar	*keyword);
612 void		 as_app_add_kudo		(AsApp		*app,
613 						 const gchar	*kudo);
614 void		 as_app_remove_kudo		(AsApp		*app,
615 						 const gchar	*kudo);
616 void		 as_app_add_kudo_kind		(AsApp		*app,
617 						 AsKudoKind	 kudo_kind);
618 void		 as_app_add_permission		(AsApp		*app,
619 						 const gchar	*permission);
620 void		 as_app_add_format		(AsApp		*app,
621 						 AsFormat	*format);
622 void		 as_app_remove_format		(AsApp		*app,
623 						 AsFormat	*format);
624 void		 as_app_add_mimetype		(AsApp		*app,
625 						 const gchar	*mimetype);
626 void		 as_app_add_pkgname		(AsApp		*app,
627 						 const gchar	*pkgname);
628 void		 as_app_add_arch		(AsApp		*app,
629 						 const gchar	*arch);
630 void		 as_app_add_release		(AsApp		*app,
631 						 AsRelease	*release);
632 void		 as_app_add_provide		(AsApp		*app,
633 						 AsProvide	*provide);
634 void		 as_app_add_launchable		(AsApp		*app,
635 						 AsLaunchable	*launchable);
636 void		 as_app_add_screenshot		(AsApp		*app,
637 						 AsScreenshot	*screenshot);
638 void		 as_app_add_review		(AsApp		*app,
639 						 AsReview	*review);
640 void		 as_app_add_content_rating	(AsApp		*app,
641 						 AsContentRating *content_rating);
642 void		 as_app_add_agreement		(AsApp		*app,
643 						 AsAgreement	*agreement);
644 void		 as_app_add_icon		(AsApp		*app,
645 						 AsIcon		*icon);
646 void		 as_app_add_bundle		(AsApp		*app,
647 						 AsBundle	*bundle);
648 void		 as_app_add_translation		(AsApp		*app,
649 						 AsTranslation	*translation);
650 void		 as_app_add_suggest		(AsApp		*app,
651 						 AsSuggest	*suggest);
652 void		 as_app_add_require		(AsApp		*app,
653 						 AsRequire	*require);
654 void		 as_app_add_language		(AsApp		*app,
655 						 gint		 percentage,
656 						 const gchar	*locale);
657 void		 as_app_add_compulsory_for_desktop (AsApp	*app,
658 						 const gchar	*compulsory_for_desktop);
659 void		 as_app_add_url			(AsApp		*app,
660 						 AsUrlKind	 url_kind,
661 						 const gchar	*url);
662 void		 as_app_add_metadata		(AsApp		*app,
663 						 const gchar	*key,
664 						 const gchar	*value);
665 void		 as_app_remove_metadata		(AsApp		*app,
666 						 const gchar	*key);
667 void		 as_app_add_addon		(AsApp		*app,
668 						 AsApp		*addon);
669 void		 as_app_add_extends		(AsApp		*app,
670 						 const gchar	*extends);
671 void		 as_app_add_quirk		(AsApp		*app,
672 						 AsAppQuirk	 quirk);
673 
674 /* object methods */
675 GPtrArray	*as_app_validate		(AsApp		*app,
676 						 guint32	 flags,
677 						 GError		**error);
678 void		 as_app_subsume			(AsApp		*app,
679 						 AsApp		*donor);
680 void		 as_app_subsume_full		(AsApp		*app,
681 						 AsApp		*donor,
682 						 guint64	 flags);
683 void		 as_app_add_veto		(AsApp		*app,
684 						 const gchar	*fmt,
685 						 ...)
686 						 G_GNUC_PRINTF(2,3);
687 void		 as_app_remove_veto		(AsApp		*app,
688 						 const gchar	*description);
689 guint		 as_app_search_matches_all	(AsApp		*app,
690 						 gchar		**search);
691 guint		 as_app_search_matches		(AsApp		*app,
692 						 const gchar	*search);
693 gboolean	 as_app_parse_file		(AsApp		*app,
694 						 const gchar	*filename,
695 						 guint32	 flags,
696 						 GError		**error);
697 gboolean	 as_app_parse_data		(AsApp		*app,
698 						 GBytes		*data,
699 						 guint32	 flags,
700 						 GError		**error);
701 gboolean	 as_app_to_file			(AsApp		*app,
702 						 GFile		*file,
703 						 GCancellable	*cancellable,
704 						 GError		**error);
705 GString		*as_app_to_xml			(AsApp		*app,
706 						 GError		**error);
707 AsContentRating	*as_app_get_content_rating	(AsApp		*app,
708 						 const gchar 	*kind);
709 AsAgreement	*as_app_get_agreement_by_kind	(AsApp		*app,
710 						 AsAgreementKind kind);
711 AsAgreement	*as_app_get_agreement_default	(AsApp		*app);
712 AsScreenshot	*as_app_get_screenshot_default	(AsApp		*app);
713 AsIcon		*as_app_get_icon_default	(AsApp		*app);
714 AsIcon		*as_app_get_icon_for_size	(AsApp		*app,
715 						 guint		 width,
716 						 guint		 height);
717 AsBundle	*as_app_get_bundle_default	(AsApp		*app);
718 AsRelease	*as_app_get_release		(AsApp		*app,
719 						 const gchar	*version);
720 AsRelease	*as_app_get_release_default	(AsApp		*app);
721 AsRelease	*as_app_get_release_by_version	(AsApp		*app,
722 						 const gchar	*version);
723 AsRequire	*as_app_get_require_by_value	(AsApp		*app,
724 						 AsRequireKind	 kind,
725 						 const gchar	*value);
726 gboolean	 as_app_convert_icons		(AsApp		*app,
727 						 AsIconKind	 kind,
728 						 GError		**error);
729 gboolean	 as_app_equal			(AsApp		*app1,
730 						 AsApp		*app2);
731 
732 /* deprecated */
733 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
734 AsIdKind	 as_app_get_id_kind		(AsApp		*app)
735 G_DEPRECATED_FOR(as_app_get_kind);
736 void		 as_app_set_id_kind		(AsApp		*app,
737 						 AsIdKind	 id_kind)
738 G_DEPRECATED_FOR(as_app_set_kind);
739 
740 void		 as_app_set_source_file		(AsApp		*app,
741 						 const gchar	*source_file)
742 G_DEPRECATED_FOR(as_app_add_format);
743 const gchar	*as_app_get_source_file		(AsApp		*app)
744 G_DEPRECATED_FOR(as_app_get_formats);
745 
746 AsFormatKind	 as_app_get_source_kind		(AsApp		*app)
747 G_DEPRECATED_FOR(as_format_get_kind);
748 void		 as_app_set_source_kind		(AsApp		*app,
749 						 AsFormatKind source_kind)
750 G_DEPRECATED_FOR(as_format_set_kind);
751 
752 AsFormatKind	 as_app_source_kind_from_string	(const gchar	*source_kind)
753 G_DEPRECATED_FOR(as_format_kind_from_string);
754 const gchar	*as_app_source_kind_to_string	(AsFormatKind source_kind)
755 G_DEPRECATED_FOR(as_format_kind_to_string);
756 
757 AsFormatKind	 as_app_guess_source_kind	(const gchar	*filename)
758 G_DEPRECATED_FOR(as_format_guess_kind);
759 
760 G_GNUC_END_IGNORE_DEPRECATIONS
761 
762 G_END_DECLS
763