[gnome-software] fwupd: Do not use deprecated API
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] fwupd: Do not use deprecated API
- Date: Tue, 31 May 2016 08:46:51 +0000 (UTC)
commit 35b3151bc9a0c459a03690bbd5d603a090f11ce2
Author: Richard Hughes <richard hughsie com>
Date: Tue May 31 09:46:13 2016 +0100
fwupd: Do not use deprecated API
src/plugins/gs-plugin-fwupd.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index e858697..a2d5a2c 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -748,8 +748,13 @@ gs_plugin_file_to_app (GsPlugin *plugin,
GsPluginData *priv = gs_plugin_get_data (plugin);
g_autofree gchar *content_type = NULL;
g_autofree gchar *filename = NULL;
+#if FWUPD_CHECK_VERSION(0,7,2)
+ guint i;
+ g_autoptr(GPtrArray) results = NULL;
+#else
g_autoptr(FwupdResult) res = NULL;
g_autoptr(GsApp) app = NULL;
+#endif
const gchar *mimetypes[] = {
"application/vnd.ms-cab-compressed",
NULL };
@@ -763,6 +768,27 @@ gs_plugin_file_to_app (GsPlugin *plugin,
/* get results */
filename = g_file_get_path (file);
+#if FWUPD_CHECK_VERSION(0,7,2)
+ results = fwupd_client_get_details_local (priv->client,
+ filename,
+ cancellable,
+ error);
+ if (results == NULL)
+ return FALSE;
+ for (i = 0; i < results->len; i++) {
+ FwupdResult *res = g_ptr_array_index (results, i);
+ g_autoptr(GsApp) app = NULL;
+
+ /* create each app */
+ app = gs_plugin_fwupd_new_app_from_results (res);
+
+ /* we have no update view for local files */
+ gs_app_set_version (app, gs_app_get_update_version (app));
+ gs_app_set_description (app, GS_APP_QUALITY_NORMAL,
+ gs_app_get_update_details (app));
+ gs_app_list_add (list, app);
+ }
+#else
res = fwupd_client_get_details (priv->client,
filename,
cancellable,
@@ -776,5 +802,7 @@ gs_plugin_file_to_app (GsPlugin *plugin,
gs_app_set_description (app, GS_APP_QUALITY_NORMAL,
gs_app_get_update_details (app));
gs_app_list_add (list, app);
+#endif
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]