Skip to content

Commit

Permalink
Merge branch 'main' into ryonakano/drop-mention-of-os-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ryonakano authored Jun 25, 2024
2 parents b4905cc + cdae51a commit 0db51b8
Show file tree
Hide file tree
Showing 10 changed files with 351 additions and 173 deletions.
1 change: 1 addition & 0 deletions data/appcenter.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<issue url="https://github.com/elementary/appcenter/issues/470">Screenshots are being stretched</issue>
<issue url="https://github.com/elementary/appcenter/issues/554">Can't search from an external source while open on an app from search</issue>
<issue url="https://github.com/elementary/appcenter/issues/736">Fonts of some categories don't support some diacritics</issue>
<issue url="https://github.com/elementary/appcenter/issues/1134">Show donation URL button if payments not enabled</issue>
<issue url="https://github.com/elementary/appcenter/issues/1590">When an app installs, the cancel button is not properly highlighted at the right edge</issue>
<issue url="https://github.com/elementary/appcenter/issues/1940">Weird previous/next buttons behaviour in screenshots carousel</issue>
<issue url="https://github.com/elementary/appcenter/issues/2035">Only show update info icon when there is info available</issue>
Expand Down
1 change: 1 addition & 0 deletions data/icons/categories.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<file alias="48x48/categories/appcenter-finance-symbolic.svg" compressed="true" preprocess="xml-stripblanks">finance-symbolic.svg</file>

<file alias="16x16/categories/currency-dollar-symbolic.svg" compressed="true" preprocess="xml-stripblanks">currency-dollar-symbolic.svg</file>
<file alias="16x16/categories/link-vcs-symbolic.svg" compressed="true" preprocess="xml-stripblanks">link-vcs.svg</file>
<file alias="16x16/apps/internet-mail-symbolic.svg"compressed="true" preprocess="xml-stripblanks">internet-mail-symbolic.svg</file>
<file alias="16x16/apps/web-browser-symbolic.svg" compressed="true" preprocess="xml-stripblanks">web-browser-symbolic.svg</file>
<file alias="16x16/mimetypes/text-x-copying-symbolic.svg" compressed="true" preprocess="xml-stripblanks">text-x-copying-symbolic.svg</file>
Expand Down
25 changes: 25 additions & 0 deletions data/icons/link-vcs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions data/styles/AppInfoView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ appinfoview {
margin: rem(6px) rem(12px) rem(12px) rem(12px);
padding: rem(12px);
}

linklistbox {
row.link grid {
padding: 0 rem(6px);
border-spacing: rem(12px) 0;
}
}
}

@keyframes loading {
Expand Down
1 change: 1 addition & 0 deletions po/POTFILES
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ src/Widgets/ActionStack.vala
src/Widgets/Banner.vala
src/Widgets/CardNumberEntry.vala
src/Widgets/HumbleButton.vala
src/Widgets/LinkListBox.vala
src/Widgets/PackageRow.vala
src/Widgets/ProgressButton.vala
src/Widgets/ReleaseRow.vala
Expand Down
10 changes: 9 additions & 1 deletion src/Dialogs/StripeDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,16 @@ public class AppCenter.Widgets.StripeDialog : Granite.Dialog {
return;
}

var normalized_id = app_id;
if (normalized_id.has_suffix (".desktop")) {
// ".desktop" is always 8 bytes in UTF-8 so we can just chop 8 bytes off the end
normalized_id = normalized_id.substring (0, normalized_id.length - 8);
}

AppCenterCore.Houston.PaymentRequest houston_request;
try {
houston_request = new AppCenterCore.Houston.PaymentRequestBuilder ()
.app_id (app_id)
.app_id (normalized_id)
.stripe_key (stripe_key)
.email (email_entry.text)
// dollars to cents
Expand All @@ -478,6 +484,8 @@ public class AppCenter.Widgets.StripeDialog : Granite.Dialog {
.build ();

yield houston_request.send (http_client);

App.add_paid_app (app_id);
} catch (Error e) {
show_error_view (_(AppCenterCore.Stripe.DEFAULT_ERROR_MESSAGE));
return;
Expand Down
170 changes: 3 additions & 167 deletions src/Views/AppInfoView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -650,62 +650,15 @@ public class AppCenter.Views.AppInfoView : Adw.NavigationPage {
load_extensions.begin ();
}

var links_flowbox = new Gtk.FlowBox () {
column_spacing = 12,
row_spacing = 6,
hexpand = true
};

var project_license = package.component.project_license;
if (project_license != null) {
string? license_copy = null;
string? license_url = null;

parse_license (project_license, out license_copy, out license_url);

var license_button = new UrlButton (_(license_copy), license_url, "text-x-copying-symbolic");

links_flowbox.append (license_button);
}

var homepage_url = package_component.get_url (AppStream.UrlKind.HOMEPAGE);
if (homepage_url != null) {
var website_button = new UrlButton (_("Homepage"), homepage_url, "web-browser-symbolic");
links_flowbox.append (website_button);
}

var translate_url = package_component.get_url (AppStream.UrlKind.TRANSLATE);
if (translate_url != null) {
var translate_button = new UrlButton (_("Translate"), translate_url, "preferences-desktop-locale-symbolic");
links_flowbox.append (translate_button);
}

var bugtracker_url = package_component.get_url (AppStream.UrlKind.BUGTRACKER);
if (bugtracker_url != null) {
var bugtracker_button = new UrlButton (_("Send Feedback"), bugtracker_url, "bug-symbolic");
links_flowbox.append (bugtracker_button);
}

var help_url = package_component.get_url (AppStream.UrlKind.HELP);
if (help_url != null) {
var help_button = new UrlButton (_("Help"), help_url, "dialog-question-symbolic");
links_flowbox.append (help_button);
}

#if PAYMENTS
if (package.get_payments_key () != null) {
var fund_button = new FundButton (package);
links_flowbox.append (fund_button);
}
#endif

var body_clamp = new Adw.Clamp () {
child = content_box,
maximum_size = MAX_WIDTH
};

var link_listbox = new LinkListBox (package_component);

var links_clamp = new Adw.Clamp () {
child = links_flowbox,
child = link_listbox,
maximum_size = MAX_WIDTH
};
links_clamp.add_css_class ("content-box");
Expand Down Expand Up @@ -1104,49 +1057,6 @@ public class AppCenter.Views.AppInfoView : Adw.NavigationPage {
});
}

private void parse_license (string project_license, out string license_copy, out string license_url) {
license_copy = null;
license_url = null;

// NOTE: Ideally this would be handled in AppStream: https://github.com/ximion/appstream/issues/107
if (project_license.has_prefix ("LicenseRef")) {
// i.e. `LicenseRef-proprietary=https://example.com`
string[] split_license = project_license.split_set ("=", 2);
if (split_license[1] != null) {
license_url = split_license[1];
}

string license_type = split_license[0].split_set ("-", 2)[1].down ();
switch (license_type) {
case "public-domain":
// TRANSLATORS: See the Wikipedia page
license_copy = _("Public Domain");
if (license_url == null) {
// TRANSLATORS: Replace the link with the version for your language
license_url = _("https://en.wikipedia.org/wiki/Public_domain");
}
break;
case "free":
// TRANSLATORS: Freedom, not price. See the GNU page.
license_copy = _("Free Software");
if (license_url == null) {
// TRANSLATORS: Replace the link with the version for your language
license_url = _("https://www.gnu.org/philosophy/free-sw");
}
break;
case "proprietary":
license_copy = _("Proprietary");
break;
default:
license_copy = _("Unknown License");
break;
}
} else {
license_copy = AppStream.get_license_name (project_license);
license_url = AppStream.get_license_url (project_license);
}
}

private async void uninstall_clicked () {
package.uninstall.begin ((obj, res) => {
try {
Expand Down Expand Up @@ -1175,80 +1085,6 @@ public class AppCenter.Views.AppInfoView : Adw.NavigationPage {
title.label = package.origin_description;
}

class UrlButton : Gtk.Box {
public UrlButton (string label, string? uri, string icon_name) {
add_css_class (Granite.STYLE_CLASS_DIM_LABEL);
tooltip_text = uri;

var icon = new Gtk.Image.from_icon_name (icon_name) {
valign = Gtk.Align.CENTER
};

var title = new Gtk.Label (label);

var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
box.append (icon);
box.append (title);

if (uri != null) {
var button = new Gtk.Button () {
child = box
};
button.add_css_class (Granite.STYLE_CLASS_FLAT);

append (button);

button.clicked.connect (() => {
new Gtk.UriLauncher (uri).launch.begin (
(Gtk.Window) get_root (),
null
);
});
} else {
append (box);
}
}
}

class FundButton : Gtk.Button {
public FundButton (AppCenterCore.Package package) {
add_css_class (Granite.STYLE_CLASS_DIM_LABEL);
add_css_class (Granite.STYLE_CLASS_FLAT);

var icon = new Gtk.Image.from_icon_name ("credit-card-symbolic") {
valign = Gtk.Align.CENTER
};

var title = new Gtk.Label (_("Fund"));

var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
box.append (icon);
box.append (title);

tooltip_text = _("Fund the development of this app");

child = box;

clicked.connect (() => {
var stripe = new Widgets.StripeDialog (
1,
package.get_name (),
package.normalized_component_id,
package.get_payments_key ()
);
stripe.transient_for = ((Gtk.Application) Application.get_default ()).active_window;

stripe.download_requested.connect (() => {
if (stripe.amount != 0) {
App.add_paid_app (package.component.get_id ());
}
});

stripe.show ();
});
}
}

private class ArrowButton : Gtk.Button {
public ArrowButton (string icon_name) {
Object (icon_name: icon_name);
Expand Down
6 changes: 1 addition & 5 deletions src/Widgets/HumbleButton.vala
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,14 @@ public class AppCenter.Widgets.HumbleButton : Gtk.Button {
var stripe_dialog = new Widgets.StripeDialog (
amount,
package.get_name (),
package.normalized_component_id,
package.component.id,
package.get_payments_key ()
) {
transient_for = ((Gtk.Application) Application.get_default ()).active_window
};

stripe_dialog.download_requested.connect (() => {
download_requested ();

if (stripe_dialog.amount != 0) {
App.add_paid_app (package.component.get_id ());
}
});

stripe_dialog.show ();
Expand Down
Loading

0 comments on commit 0db51b8

Please sign in to comment.