[gnome-software] trivial: Factor out gs_flatpak_file_to_app() for future use
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Factor out gs_flatpak_file_to_app() for future use
- Date: Wed, 1 Jun 2016 13:22:44 +0000 (UTC)
commit 981fa4e55daa3a5dac31aeb4747de8c7c1cc0642
Author: Richard Hughes <richard hughsie com>
Date: Wed Jun 1 14:16:20 2016 +0100
trivial: Factor out gs_flatpak_file_to_app() for future use
src/plugins/gs-flatpak.c | 52 +++++++++++++++++++++++++++++++---------------
1 files changed, 35 insertions(+), 17 deletions(-)
---
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 79b6a3c..773a7b5 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -1291,13 +1291,13 @@ gs_flatpak_update_app (GsPlugin *plugin,
return TRUE;
}
-gboolean
-gs_flatpak_file_to_app (GsPlugin *plugin,
- FlatpakInstallation *installation,
- GsAppList *list,
- GFile *file,
- GCancellable *cancellable,
- GError **error)
+static gboolean
+gs_flatpak_file_to_app_bundle (GsPlugin *plugin,
+ FlatpakInstallation *installation,
+ GsAppList *list,
+ GFile *file,
+ GCancellable *cancellable,
+ GError **error)
{
g_autofree gchar *content_type = NULL;
g_autofree gchar *id_prefixed = NULL;
@@ -1306,16 +1306,6 @@ gs_flatpak_file_to_app (GsPlugin *plugin,
g_autoptr(GBytes) metadata = NULL;
g_autoptr(GsApp) app = NULL;
g_autoptr(FlatpakBundleRef) xref_bundle = NULL;
- const gchar *mimetypes[] = {
- "application/vnd.flatpak",
- NULL };
-
- /* does this match any of the mimetypes we support */
- content_type = gs_utils_get_content_type (file, cancellable, error);
- if (content_type == NULL)
- return FALSE;
- if (!g_strv_contains (mimetypes, content_type))
- return TRUE;
/* load bundle */
xref_bundle = flatpak_bundle_ref_new (file, error);
@@ -1416,3 +1406,31 @@ gs_flatpak_file_to_app (GsPlugin *plugin,
gs_app_list_add (list, app);
return TRUE;
}
+
+gboolean
+gs_flatpak_file_to_app (GsPlugin *plugin,
+ FlatpakInstallation *installation,
+ GsAppList *list,
+ GFile *file,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_autofree gchar *content_type = NULL;
+ const gchar *mimetypes_bundle[] = {
+ "application/vnd.flatpak",
+ NULL };
+
+ /* does this match any of the mimetypes_bundle we support */
+ content_type = gs_utils_get_content_type (file, cancellable, error);
+ if (content_type == NULL)
+ return FALSE;
+ if (g_strv_contains (mimetypes_bundle, content_type)) {
+ return gs_flatpak_file_to_app_bundle (plugin,
+ installation,
+ list,
+ file,
+ cancellable,
+ error);
+ }
+ return TRUE;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]