Update the GTK UI for install errors to match the Mac and Windows UIs

* Display the error details in a message box
 * Set the progress label text appropriately in the event of an error
This commit is contained in:
Robert Knight 2011-08-24 12:15:02 +01:00
parent ddff071b8c
commit 557dc1273e
2 changed files with 29 additions and 6 deletions

View file

@ -8,6 +8,7 @@
UpdateDialogGtk::UpdateDialogGtk()
: m_restartApp(false)
, m_hadError(false)
{
}
@ -81,14 +82,35 @@ gboolean UpdateDialogGtk::notify(void* _message)
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(dialog->m_progressBar),message->progress/100.0);
break;
case UpdateMessage::UpdateFailed:
gtk_label_set_text(GTK_LABEL(dialog->m_progressLabel),
("There was a problem installing the update: " + message->message).c_str());;
gtk_widget_set_sensitive(dialog->m_finishButton,true);
{
dialog->m_hadError = true;
std::string errorMessage = "There was a problem installing the update:\n\n" + message->message;
GtkWidget* errorDialog = gtk_message_dialog_new (GTK_WINDOW(dialog->m_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s",
errorMessage.c_str());
gtk_dialog_run (GTK_DIALOG (errorDialog));
gtk_widget_destroy (errorDialog);
gtk_widget_set_sensitive(dialog->m_finishButton,true);
}
break;
case UpdateMessage::UpdateFinished:
gtk_label_set_text(GTK_LABEL(dialog->m_progressLabel),
"Update installed. Click 'Finish' to restart the application.");
gtk_widget_set_sensitive(dialog->m_finishButton,true);
{
std::string message;
if (dialog->m_hadError)
{
message = "Update failed.";
}
else
{
message = "Update installed.";
}
message += " Click 'Finish' to restart the application.";
gtk_label_set_text(GTK_LABEL(dialog->m_progressLabel),message.c_str());
gtk_widget_set_sensitive(dialog->m_finishButton,true);
}
break;
}
delete message;

View file

@ -31,5 +31,6 @@ class UpdateDialogGtk : public UpdateObserver
GtkWidget* m_finishButton;
GtkWidget* m_progressBar;
bool m_restartApp;
bool m_hadError;
};