Skip to content

Commit

Permalink
AbstractAppContainer: Remove curated warning dialog (#1841)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored May 9, 2022
1 parent 91ad6aa commit d6ae9d7
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 146 deletions.
5 changes: 0 additions & 5 deletions data/io.elementary.appcenter.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
<summary>List of package names of drivers that may be required</summary>
<description>Speeds up loading of updates view by remembering which drivers may be required</description>
</key>
<key type="b" name="non-curated-warning">
<default>true</default>
<summary>Display warning for non-curated apps</summary>
<description>Whether to display a warning dialog when attempting to install apps are not from a curated source</description>
</key>
<key type="x" name="last-refresh-time">
<default>0</default>
<summary>Unix UTC time of last cache refresh</summary>
Expand Down
1 change: 0 additions & 1 deletion po/POTFILES
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ src/Core/Task.vala
src/Core/UbuntuDriversBackend.vala
src/Core/UpdateManager.vala
src/Dialogs/InstallFailDialog.vala
src/Dialogs/NonCuratedWarningDialog.vala
src/Dialogs/StripeDialog.vala
src/Dialogs/UninstallConfirmDialog.vala
src/Dialogs/UninstallFailDialog.vala
Expand Down
89 changes: 0 additions & 89 deletions src/Dialogs/NonCuratedWarningDialog.vala

This file was deleted.

52 changes: 2 additions & 50 deletions src/Widgets/AppContainers/AbstractAppContainer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,11 @@ namespace AppCenter {
action_button_revealer.add (action_button);

action_button.download_requested.connect (() => {
if (install_approved ()) {
action_clicked.begin ();
}
action_clicked.begin ();
});

action_button.payment_requested.connect ((amount) => {
if (install_approved ()) {
show_stripe_dialog (amount);
}
show_stripe_dialog (amount);
});

uninstall_button = new Gtk.Button.with_label (_("Uninstall")) {
Expand Down Expand Up @@ -347,49 +343,5 @@ namespace AppCenter {
}
});
}

private bool install_approved () {
bool approved = true;
#if CURATED
var curated_dialog_allowed = App.settings.get_boolean ("non-curated-warning");
var app_installed = package.state != AppCenterCore.Package.State.NOT_INSTALLED;
var app_curated = package.is_native || package.is_os_updates;

// Only show the curated dialog if the user has left them enabled, the app isn't installed
// and it isn't a curated app
if (curated_dialog_allowed && !app_installed && !app_curated) {
approved = false;

var non_curated_warning = new Widgets.NonCuratedWarningDialog (package.get_name ());
non_curated_warning.transient_for = (Gtk.Window) get_toplevel ();

non_curated_warning.response.connect ((response_id) => {
switch (response_id) {
case Gtk.ResponseType.OK:
approved = true;
break;
case Gtk.ResponseType.CANCEL:
case Gtk.ResponseType.CLOSE:
case Gtk.ResponseType.DELETE_EVENT:
approved = false;
break;
default:
assert_not_reached ();
}

non_curated_warning.close ();
});

non_curated_warning.run ();
non_curated_warning.destroy ();

// If the install has been rejected at this stage, return early
if (!approved) {
return false;
}
}
#endif
return approved;
}
}
}
1 change: 0 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ appcenter_files = files(
'Core/UbuntuDriversBackend.vala',
'Core/UpdateManager.vala',
'Dialogs/InstallFailDialog.vala',
'Dialogs/NonCuratedWarningDialog.vala',
'Dialogs/StripeDialog.vala',
'Dialogs/UninstallConfirmDialog.vala',
'Dialogs/UninstallFailDialog.vala',
Expand Down

0 comments on commit d6ae9d7

Please sign in to comment.