Improve keys and 'game already running' dialogs

This commit is contained in:
Thog 2020-01-24 23:06:21 +01:00
commit 78d43694c3
3 changed files with 16 additions and 6 deletions

View file

@ -51,7 +51,7 @@ namespace Ryujinx
string userProfilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".switch", "prod.keys"); string userProfilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".switch", "prod.keys");
if (!File.Exists(appDataPath) && !File.Exists(userProfilePath) && !Migration.IsMigrationNeeded()) if (!File.Exists(appDataPath) && !File.Exists(userProfilePath) && !Migration.IsMigrationNeeded())
{ {
GtkDialog.CreateErrorDialog("Key file was not found. Please refer to `KEYS.md` for more info"); GtkDialog.CreateWarningDialog("Key file was not found", "Please refer to `KEYS.md` for more info");
} }
MainWindow mainWindow = new MainWindow(); MainWindow mainWindow = new MainWindow();

View file

@ -5,19 +5,29 @@ namespace Ryujinx.Ui
{ {
internal class GtkDialog internal class GtkDialog
{ {
internal static void CreateErrorDialog(string errorMessage) internal static void CreateDialog(string title, string text, string secondaryText)
{ {
MessageDialog errorDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, null) MessageDialog errorDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, null)
{ {
Title = "Ryujinx - Error", Title = title,
Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png"), Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png"),
Text = "Ryujinx has encountered an error", Text = text,
SecondaryText = errorMessage, SecondaryText = secondaryText,
WindowPosition = WindowPosition.Center WindowPosition = WindowPosition.Center
}; };
errorDialog.SetSizeRequest(100, 20); errorDialog.SetSizeRequest(100, 20);
errorDialog.Run(); errorDialog.Run();
errorDialog.Dispose(); errorDialog.Dispose();
} }
internal static void CreateWarningDialog(string text, string secondaryText)
{
CreateDialog("Ryujinx - Warning", text, secondaryText);
}
internal static void CreateErrorDialog(string errorMessage)
{
CreateDialog("Ryujinx - Error", "Ryujinx has encountered an error", errorMessage);
}
} }
} }

View file

@ -232,7 +232,7 @@ namespace Ryujinx.Ui
{ {
if (_gameLoaded) if (_gameLoaded)
{ {
GtkDialog.CreateErrorDialog("A game has already been loaded. Please close the emulator and try again"); GtkDialog.CreateDialog("Ryujinx", "A game has already been loaded", "Please close it first and try again.");
} }
else else
{ {