fix: Showing the about panel is async on all platforms (#37440)
* fix: about panel is a base::Value::Dict * nix this test for a diff PR * what if the about dialog was not blocking * add this test back in * document synchronicity * github editor is a fan of spaces
This commit is contained in:
parent
829fb4f586
commit
c8f715f9a1
4 changed files with 13 additions and 4 deletions
|
@ -1357,7 +1357,7 @@ This API must be called after the `ready` event is emitted.
|
||||||
|
|
||||||
### `app.showAboutPanel()`
|
### `app.showAboutPanel()`
|
||||||
|
|
||||||
Show the app's about panel options. These options can be overridden with `app.setAboutPanelOptions(options)`.
|
Show the app's about panel options. These options can be overridden with `app.setAboutPanelOptions(options)`. This function runs asynchronously.
|
||||||
|
|
||||||
### `app.setAboutPanelOptions(options)`
|
### `app.setAboutPanelOptions(options)`
|
||||||
|
|
||||||
|
|
|
@ -212,8 +212,11 @@ void Browser::ShowAboutPanel() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_dialog_run(GTK_DIALOG(dialog));
|
// destroy the widget when it closes
|
||||||
gtk_widget_destroy(dialogWidget);
|
g_signal_connect_swapped(dialogWidget, "response",
|
||||||
|
G_CALLBACK(gtk_widget_destroy), dialogWidget);
|
||||||
|
|
||||||
|
gtk_widget_show_all(dialogWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::SetAboutPanelOptions(base::Value::Dict options) {
|
void Browser::SetAboutPanelOptions(base::Value::Dict options) {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by the MIT license that can be
|
// Use of this source code is governed by the MIT license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "base/functional/bind.h"
|
||||||
#include "shell/browser/browser.h"
|
#include "shell/browser/browser.h"
|
||||||
|
|
||||||
// must come before other includes. fixes bad #defines from <shlwapi.h>.
|
// must come before other includes. fixes bad #defines from <shlwapi.h>.
|
||||||
|
@ -765,7 +766,8 @@ void Browser::ShowAboutPanel() {
|
||||||
settings.message = aboutMessage;
|
settings.message = aboutMessage;
|
||||||
settings.icon = image;
|
settings.icon = image;
|
||||||
settings.type = electron::MessageBoxType::kInformation;
|
settings.type = electron::MessageBoxType::kInformation;
|
||||||
electron::ShowMessageBoxSync(settings);
|
electron::ShowMessageBox(settings,
|
||||||
|
base::BindOnce([](int, bool) { /* do nothing. */ }));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::SetAboutPanelOptions(base::Value::Dict options) {
|
void Browser::SetAboutPanelOptions(base::Value::Dict options) {
|
||||||
|
|
|
@ -1867,6 +1867,10 @@ describe('app module', () => {
|
||||||
version: '1.2.3'
|
version: '1.2.3'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('app.showAboutPanel() does not crash & runs asynchronously', () => {
|
||||||
|
app.showAboutPanel();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue