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

Fix crash when deleting characters out of searches #216

Merged
merged 2 commits into from
Apr 7, 2017
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
10 changes: 10 additions & 0 deletions src/Core/Package.vala
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public class AppCenterCore.Package : Object {
private string? summary = null;
private string? color_primary = null;
private string? color_primary_text = null;
private string? payments_key = null;
private string? _latest_version = null;
public string? latest_version {
private get { return _latest_version; }
Expand Down Expand Up @@ -371,6 +372,15 @@ public class AppCenterCore.Package : Object {
}
}

public string? get_payments_key () {
if (payments_key != null) {
return payments_key;
} else {
payments_key = component.get_custom_value ("x-appcenter-stripe");
return payments_key;
}
}

private string convert_version (string version) {
string returned = version;
returned = returned.split ("+", 2)[0];
Expand Down
7 changes: 2 additions & 5 deletions src/Widgets/AbstractAppContainer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,13 @@ namespace AppCenter {
}
}

private string? payments_key_ = null;
public bool payments_enabled {
get {
if (this.package == null || this.package.component == null || updates_view) {
return false;
} else if (payments_key_ == null) {
payments_key_ = this.package.component.get_custom_value ("x-appcenter-stripe");
}

return payments_key_ != null;
return this.package.get_payments_key() != null;
}
}

Expand All @@ -93,7 +90,7 @@ namespace AppCenter {
action_button.download_requested.connect (() => action_clicked.begin ());

action_button.payment_requested.connect ((amount) => {
var stripe = new Widgets.StripeDialog (amount, this.package_name.label, this.package.component.get_desktop_id ().replace (".desktop", ""), payments_key_);
var stripe = new Widgets.StripeDialog (amount, this.package_name.label, this.package.component.get_desktop_id ().replace (".desktop", ""), this.package.get_payments_key());

stripe.download_requested.connect (() => action_clicked.begin ());
stripe.show ();
Expand Down