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

Pretty output Flatpak package origins #1962

Merged
merged 3 commits into from
Dec 29, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/Core/FlatpakBackend.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,26 @@ public class AppCenterCore.FlatpakPackage : Package {
component: component
);
}

public string remote_title {
owned get {
unowned string origin = component.get_origin ();
var description = origin;

try {
var remote = installation.get_remote_by_name (origin, null);
description = remote.get_title ();
} catch (Error e) {
warning ("Unable to fetch remote: %s", description);
}

if (installation == FlatpakBackend.system_installation) {
return _("%s (system-wide)").printf (description);
}

return description;
}
}
}

public class AppCenterCore.FlatpakBackend : Backend, Object {
Expand Down
6 changes: 3 additions & 3 deletions src/Core/Package.vala
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,11 @@ public class AppCenterCore.Package : Object {
}
} else if (backend is FlatpakBackend) {
var fp_package = this as FlatpakPackage;
if (fp_package != null && fp_package.installation == FlatpakBackend.system_installation) {
return _("%s (system-wide)").printf (origin);
if (fp_package == null) {
return origin;
}

return origin;
return fp_package.remote_title;
} else if (backend is UbuntuDriversBackend) {
return _("Ubuntu Drivers");
}
Expand Down