summaryrefslogtreecommitdiff
path: root/client/as-util.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2017-02-27 10:30:45 +0000
committerRichard Hughes <richard@hughsie.com>2017-02-27 11:36:28 +0000
commitf764ee1fbe80bee4dffa6924744173d457957290 (patch)
tree8ccf44418ede09997287317d983c3025f0076482 /client/as-util.c
parentcbf6498b64a62ef7a7d1c1472f312630ad93d4d3 (diff)
downloadappstream-glib-f764ee1fbe80bee4dffa6924744173d457957290.tar.gz
Deprecate app_set_source_file() and app_set_source_kind()
Implement these in terms of AsFormat objects to maintain API compatibility. This allows us to have multiple 'formats' that make up an AsApp, for instance, an application might be referenced in: * The .desktop file (for the icon) * The AppData file (for the installed long description) * The AppStream XML file (for the origin information) Doing this allows us to keep track of all formats that make up an AsApp, and this allows us to update the state as each type is removed and added. This allows us to remove the need to "promote" apps to different types, which was unreliable and was the source of several bugs where the AsApp was removed from the AsStore before all the sources had been removed. With this commit, GNOME Software again works reliably.
Diffstat (limited to 'client/as-util.c')
-rw-r--r--client/as-util.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/client/as-util.c b/client/as-util.c
index 78736ac..aef892f 100644
--- a/client/as-util.c
+++ b/client/as-util.c
@@ -2970,14 +2970,16 @@ as_util_check_root_app_icon (AsApp *app, GError **error)
static void
as_util_check_root_app (AsApp *app, GPtrArray *problems)
{
+ AsFormat *format;
g_autoptr(GError) error_local = NULL;
/* skip */
- if (as_app_get_source_kind (app) == AS_FORMAT_KIND_METAINFO)
+ format = as_app_get_format_default (app);
+ if (as_format_get_kind (format) == AS_FORMAT_KIND_METAINFO)
return;
/* relax this for now */
- if (as_app_get_source_kind (app) == AS_FORMAT_KIND_DESKTOP)
+ if (as_format_get_kind (format) == AS_FORMAT_KIND_DESKTOP)
return;
/* check one line summary */
@@ -2985,7 +2987,7 @@ as_util_check_root_app (AsApp *app, GPtrArray *problems)
g_ptr_array_add (problems,
g_strdup_printf ("%s has no Comment\n - Source: %s",
as_app_get_id (app),
- as_app_get_source_file (app)));
+ as_format_get_filename (format)));
}
/* check icon exists and is large enough */
@@ -2993,7 +2995,7 @@ as_util_check_root_app (AsApp *app, GPtrArray *problems)
g_ptr_array_add (problems,
g_strdup_printf ("%s\n - Source: %s",
error_local->message,
- as_app_get_source_file (app)));
+ as_format_get_filename (format)));
}
}