summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@dfupdate.se>2023-03-25 16:34:50 +0100
committerMarcus Lundblad <ml@dfupdate.se>2023-03-26 22:50:52 +0200
commit4d17f100fcc4e8990eab64d0cdde99c8565a16bb (patch)
tree8db77d2eff806dd4c0682f6449aa5d1dc1da175d
parent13798c112adf1a68ad142e8bdd9e419fd9f3658b (diff)
downloadgnome-maps-4d17f100fcc4e8990eab64d0cdde99c8565a16bb.tar.gz
mapView: Use Adw.MessageDialog for shape layer confirmation
Replace the usage of a Gtk.MessageDialog with an Adw.MessageDialog for the confirmation dialog when loading large shape layers.
-rw-r--r--src/mapView.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/mapView.js b/src/mapView.js
index d7f91e5f..537373a7 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -19,6 +19,7 @@
* Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
*/
+import Adw from 'gi://Adw';
import GObject from 'gi://GObject';
import Gdk from 'gi://Gdk';
import GeocodeGlib from 'gi://GeocodeGlib';
@@ -514,19 +515,25 @@ export class MapView extends Gtk.Overlay {
if (result.confirmLoad) {
let totalFileSizeMB = result.totalFileSizeMB;
- let dialog = new Gtk.MessageDialog ({
+ let dialog = new Adw.MessageDialog ({
transient_for: this._mainWindow,
modal: true,
- buttons: Gtk.ButtonsType.OK_CANCEL,
- text: _("Do you want to continue?"),
- secondary_text: _("You are about to open files with a total " +
- "size of %s MB. This could take some time to" +
- " load").format(totalFileSizeMB.toLocaleString(undefined,
- { maximumFractionDigits: 1 }))
+ heading: _("Do you want to continue?"),
+ body: _("You are about to open files with a total " +
+ "size of %s MB. This could take some time to" +
+ " load").format(totalFileSizeMB.toLocaleString(undefined,
+ { maximumFractionDigits: 1 }))
});
+ dialog.add_response('cancel', _("Cancel"));
+ dialog.add_response('continue', _("Continue"));
+ dialog.set_response_appearance('continue',
+ Adw.ResponseAppearance.SUGGESTED);
+ dialog.set_default_response('cancel');
+ dialog.set_close_response('cancel');
+
dialog.connect('response', (widget, responseId) => {
- if (responseId === Gtk.ResponseType.OK) {
+ if (responseId === 'continue') {
this._loadShapeLayers(files);
}
dialog.destroy();