-
-
Notifications
You must be signed in to change notification settings - Fork 103
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 #2099
Changes from 15 commits
415fee6
ec988cd
9706f26
7049070
bb780e7
5450a42
2c5a941
002a648
58a6e0a
836e630
0794215
89c6929
0b4f128
2342ea5
d93e135
1353cfc
721ece3
d0bde20
8589b14
9e335a6
c2adcea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -310,7 +310,16 @@ public class AppCenter.Views.AppInfoView : AppCenter.AbstractAppContainer { | |||||||||||||||||||
oars_flowbox.add (uncurated); | ||||||||||||||||||||
} | ||||||||||||||||||||
#endif | ||||||||||||||||||||
|
||||||||||||||||||||
#if HAS_APPSTREAM_1_0 | ||||||||||||||||||||
var active_locale = "en_US"; | ||||||||||||||||||||
var languages = package_component.get_languages (); | ||||||||||||||||||||
if (languages.length () > 0) { | ||||||||||||||||||||
active_locale = languages.nth_data (0); | ||||||||||||||||||||
} | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the However, I'm not sure how correct the existing code is, the But, these changes should be closer to the original AppStream < 1.0 code.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yeah so what this is intended to do is get the user's current locale and then immediately after this we check if it's US English and if it is we don't show localization information because US English will always be 100% and report 0% |
||||||||||||||||||||
#else | ||||||||||||||||||||
var active_locale = package_component.get_active_locale (); | ||||||||||||||||||||
#endif | ||||||||||||||||||||
if (active_locale != "en_US") { | ||||||||||||||||||||
var percent_translated = package_component.get_language ( | ||||||||||||||||||||
// Expects language without locale | ||||||||||||||||||||
|
@@ -492,7 +501,11 @@ public class AppCenter.Views.AppInfoView : AppCenter.AbstractAppContainer { | |||||||||||||||||||
} | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
#if HAS_APPSTREAM_1_0 | ||||||||||||||||||||
screenshots = package_component.get_screenshots_all (); | ||||||||||||||||||||
#else | ||||||||||||||||||||
screenshots = package_component.get_screenshots (); | ||||||||||||||||||||
#endif | ||||||||||||||||||||
|
||||||||||||||||||||
if (screenshots.length > 0) { | ||||||||||||||||||||
screenshot_carousel = new Hdy.Carousel () { | ||||||||||||||||||||
|
@@ -1030,7 +1043,11 @@ public class AppCenter.Views.AppInfoView : AppCenter.AbstractAppContainer { | |||||||||||||||||||
get_app_download_size.begin (); | ||||||||||||||||||||
|
||||||||||||||||||||
Idle.add (() => { | ||||||||||||||||||||
#if HAS_APPSTREAM_1_0 | ||||||||||||||||||||
var releases = package.component.get_releases_plain ().get_entries (); | ||||||||||||||||||||
#else | ||||||||||||||||||||
var releases = package.component.get_releases (); | ||||||||||||||||||||
#endif | ||||||||||||||||||||
|
||||||||||||||||||||
foreach (unowned var release in releases) { | ||||||||||||||||||||
if (release.get_version () == null) { | ||||||||||||||||||||
|
@@ -1049,7 +1066,13 @@ public class AppCenter.Views.AppInfoView : AppCenter.AbstractAppContainer { | |||||||||||||||||||
|
||||||||||||||||||||
release_carousel.add (release_row); | ||||||||||||||||||||
|
||||||||||||||||||||
#if HAS_APPSTREAM_1_0 | ||||||||||||||||||||
var release_version = new AppStream.Relation (); | ||||||||||||||||||||
release_version.set_version (release.get_version ()); | ||||||||||||||||||||
if (package.installed && release_version.version_compare (package.get_version ())) { | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if that's the correct way to handle this... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've left an alternative suggestion in a review comment for checking/testing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haven't tested if this compiles or works, but this feels closer to the original:
Suggested change
|
||||||||||||||||||||
#else | ||||||||||||||||||||
if (package.installed && AppStream.utils_compare_versions (release.get_version (), package.get_version ()) <= 0) { | ||||||||||||||||||||
#endif | ||||||||||||||||||||
break; | ||||||||||||||||||||
} | ||||||||||||||||||||
} | ||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -116,7 +116,11 @@ public class AppCenter.Widgets.ReleaseRow : Gtk.Box { | |||||
private string format_release_description (string? description ) { | ||||||
if (description != null) { | ||||||
try { | ||||||
#if HAS_APPSTREAM_1_0 | ||||||
var markup = AppStream.markup_convert (description, AppStream.MarkupKind.XML); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm assuming we only convert XML 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
As above |
||||||
#else | ||||||
var markup = AppStream.markup_convert_simple (description); | ||||||
#endif | ||||||
|
||||||
if (markup.strip () != "") { | ||||||
return markup; | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming we only convert XML 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 2nd parameter is the format to convert to.
markup_convert_simple
in AppStream < 1.0 converts to theTEXT
markup kind, soXML
here would be a difference in behaviour with the Appstream 1.0 code and should probably be changed toTEXT
.That said, it feels like we'd want to keep the description as markup so we can display it more richly in the interface, but I think checking and testing that is outside the scope of supporting AppStream 1.0
I've opened #2103 to investigate whether converting to
TEXT
is still correct.