Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AppStream 1.0 #102

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ appstream_dep = dependency ('appstream', version: '>=0.12.10')
if appstream_dep.version().version_compare('>=0.15')
add_project_arguments('--define=HAS_APPSTREAM_0_15', language:'vala')
endif
if appstream_dep.version().version_compare('>=1.0')
add_project_arguments('--define=HAS_APPSTREAM_1_0', language:'vala')
endif

add_project_arguments('-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name()), language:'c')

Expand Down
16 changes: 16 additions & 0 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ public class Feedback.MainWindow : Gtk.ApplicationWindow {
foreach (var app in app_entries) {
var component_table = new HashTable<string, AppStream.Component> (str_hash, str_equal);

#if HAS_APPSTREAM_1_0
appstream_pool.get_components_by_id (app).as_array ().foreach ((component) => {
#else
appstream_pool.get_components_by_id (app).foreach ((component) => {
#endif
if (component_table[component.id] == null) {
component_table[component.id] = component;

Expand Down Expand Up @@ -185,7 +189,11 @@ public class Feedback.MainWindow : Gtk.ApplicationWindow {
placeholder_stack.visible_child = placeholder;
});

#if HAS_APPSTREAM_1_0
appstream_pool.get_components_by_id ("io.elementary.switchboard").as_array ().foreach ((component) => {
#else
appstream_pool.get_components_by_id ("io.elementary.switchboard").foreach ((component) => {
#endif
component.get_addons ().foreach ((addon) => {
var repo_row = new RepoRow (
addon.name,
Expand All @@ -198,7 +206,11 @@ public class Feedback.MainWindow : Gtk.ApplicationWindow {
});
});

#if HAS_APPSTREAM_1_0
appstream_pool.get_components_by_id ("io.elementary.wingpanel").as_array ().foreach ((component) => {
#else
appstream_pool.get_components_by_id ("io.elementary.wingpanel").foreach ((component) => {
#endif
component.get_addons ().foreach ((addon) => {
var repo_row = new RepoRow (
addon.name,
Expand Down Expand Up @@ -362,7 +374,11 @@ public class Feedback.MainWindow : Gtk.ApplicationWindow {

var components = new GenericArray<AppStream.Component> ();
new Thread<void> ("get_compulsory_for_desktop", () => {
#if HAS_APPSTREAM_1_0
appstream_pool.get_components ().as_array ().foreach ((component) => {
#else
appstream_pool.get_components ().foreach ((component) => {
#endif
component.get_compulsory_for_desktops ().foreach ((desktop) => {
if (desktop == Environment.get_variable ("XDG_CURRENT_DESKTOP")) {
components.add (component);
Expand Down