Skip to content

Commit

Permalink
Helpful error (#302)
Browse files Browse the repository at this point in the history
Co-authored-by: Brock <brock@pop-os.localdomain>
Co-authored-by: Jacob Kauffmann <jacobgkau@users.noreply.github.com>
  • Loading branch information
3 people committed Nov 11, 2021
1 parent 47b72d1 commit 60d6e84
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
12 changes: 11 additions & 1 deletion src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,18 @@ public class AppCenter.App : Gtk.Application {
var dialog = new InstallFailDialog (package, error);

dialog.show_all ();
dialog.response.connect ((response_id) => {
switch (response_id) {
case Gtk.ResponseType.CLOSE:
dialog.destroy ();
break;
case Gtk.ResponseType.OK:
dialog.destroy ();
main_window.go_to_installed_clear ();
break;
}
});
dialog.run ();
dialog.destroy ();
}

break;
Expand Down
14 changes: 8 additions & 6 deletions src/Dialogs/InstallFailDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public class InstallFailDialog : Granite.MessageDialog {
public InstallFailDialog (AppCenterCore.Package? package, Error error) {
Object (
title: "",
secondary_text: _("This may be a temporary issue or could have been caused by external or manually compiled software."),
buttons: Gtk.ButtonsType.CLOSE,
secondary_text: _("• Install all available updates via the Installed tab of the Pop!_Shop, reboot, and try again.\n\n• If the software supports multiple installation types, use the drop-down next to the Install button to select a different option and try again."),
badge_icon: new ThemedIcon ("dialog-error"),
window_position: Gtk.WindowPosition.CENTER,
error: error,
Expand All @@ -34,14 +33,17 @@ public class InstallFailDialog : Granite.MessageDialog {

construct {
if (package == null) {
primary_text = _("Failed to install app");
primary_text = _("Failed to install Applicaton.\n\nTry the following to resolve this error:\n");
image_icon = new ThemedIcon (FALLBACK_ICON);
} else {
primary_text = _("Failed to install %s").printf (package.get_name ());
primary_text = _("Failed to install %s.\n\nTry the following to resolve this error:\n").printf(package.get_name ());
image_icon = package.get_icon (48, get_scale_factor ());
}

response.connect (() => destroy ());

add_button (_("Ignore"), Gtk.ResponseType.CLOSE);
var updates_button = add_button (_("Check For Updates"), Gtk.ResponseType.OK);
updates_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
updates_button.grab_focus ();

show_error_details (error.message);
}
Expand Down
8 changes: 8 additions & 0 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,14 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow {
view_mode.selected = installed_view_id;
}

public void go_to_installed_clear () {
go_to_installed ();
homepage.return_clicked ();
return_button_history.clear ();
return_button.no_show_all = true;
return_button.visible = false;
}

public void search (string term, bool mimetype = false) {
this.mimetype = mimetype;
search_entry.text = term;
Expand Down

0 comments on commit 60d6e84

Please sign in to comment.