Skip to content

Commit

Permalink
Add support for AppStream 1.0 (#275)
Browse files Browse the repository at this point in the history
* meson: Add define if AppStream version >= 1.0

* FirmwareReleaseView: Add support for AppStream 1.0
  • Loading branch information
meisenzahl committed Nov 16, 2023
1 parent 4ad86e9 commit 72d7da1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ libdir = join_paths(prefix, get_option('libdir'))

glib_dep = dependency('glib-2.0', version: '>=2.64.0')

appstream_dep = dependency ('appstream', version: '>=0.12.10')

add_project_arguments(
'-DGETTEXT_PACKAGE="@0@"'.format(gettext_name),
language:'c'
Expand All @@ -28,6 +30,10 @@ if glib_dep.version().version_compare ('>=2.73.0')
vala_flags += ['--define', 'HAS_GLIB_2_73']
endif

if appstream_dep.version().version_compare('>=1.0')
vala_flags += ['--define', 'HAS_APPSTREAM_1_0']
endif

add_project_arguments(vala_flags, language: 'vala')

subdir('data')
Expand Down
4 changes: 4 additions & 0 deletions src/Views/FirmwareReleaseView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ public class About.FirmwareReleaseView : Gtk.Grid {

summary_label.label = release.get_summary ();
try {
#if HAS_APPSTREAM_1_0
description_label.label = AppStream.markup_convert (release.get_description (), AppStream.MarkupKind.XML);
#else
description_label.label = AppStream.markup_convert_simple (release.get_description ());
#endif
} catch (Error e) {
description_label.label = "";
warning ("Could not convert markup of release: %s", e.message);
Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ shared_module(
dependency('gudev-1.0'),
dependency('udisks2'),
dependency('libhandy-1'),
dependency ('appstream', version: '>=0.12.10'),
appstream_dep,
meson.get_compiler('vala').find_library('posix'),
switchboard_dep
],
Expand Down

0 comments on commit 72d7da1

Please sign in to comment.